Niccolò Machiavelli said this quote

It is necessary for a prince wishing to hold his own to know how to do wrong, and to make use of it or not according to necessity.