The maxims are, first, that the individual is not accountable to society for his actions, in so far as these concern the interests of no person but himself.
…
Secondly, that for such actions as are prejudicial to the interests of others, the individual is accountable, and may be subjected either to social or to legal punishment, if society is of opinion that the one or the other is requisite for its protection.
John Stuart Mill, On Liberty, Utilitarianism, and Other Essays (Oxford University Press, 2015, p. 91)
