The end justifies the means
The end justifies the means is a phrase of Sergey Nechayev, the 19th century Russian revolutionary. It means that if a goal is morally important enough, any method of getting it is acceptable. It was later picked up and used to justify murderous acts by Lenin and Stalin.[source?]
The idea is ancient, but it was not meant to justify unnecessary cruelty. It was part of a political philosophy called consequentialism. The basic idea is that a policy can be judged by its outcome. All modern versions of consequentialism have to deal with the limitations necessary to prevent tyrants abusing this idea.