Full Idea
The doctrine of will has been invented essentially for the purpose of punishment, that is of finding guilty.
Gist of Idea
The doctrine of free will has been invented essentially in order to blame and punish people
Source
Friedrich Nietzsche (Twilight of the Idols [1889], 5.7)
Book Reference
Nietzsche,Friedrich: 'Twilight of the Idols and The Anti-Christ', ed/tr. Hollingdale,R.J. [Penguin 1972], p.53
A Reaction
Michael Frede says free will was invented to feel wholly in charge of our own actions. I doubt whether punishment was the first motive. The will just gives a simple explanation of actions.