First, let's try to understand the sense in which the word "justifies" is used in the familiar statement that "the end justifies the means." After that we can consider the problem you raise about whether it is all right to employ any means - good or bad - so long as the end is good.
When we say that something is "justified," we are simply saying that it is right. Thus, for example, when we say that a college is justified in expelling a student who falls below a passing mark, we are acknowledging that the college has a right to set certain standards of performance and to require its students to meet them. Hence, the college is right in expelling the student who doesn't.
In most societies, killing a human being is seen as a bad thing to do. But what do you do when a country declares war against you? The "end" in this case is the end of the war. If you do nothing and stick to your moral grounds, you will be destroyed, but the war will be over. If you take up arms to defend yourself, you are violating your moral code for the sake of stopping the war..
An enterprise can succeed only if it has a goal. To achieve that goal an effective method should be adopted. The method can be harmless with no violence in it. Or it can be hard and cruel which calls for a lot of violence. In both cases the goal is the same. Only the method of achieving it is different. The proverb, a very disputable one, means that if the goal is good the methods adopted for achieving it do not matter. It can be good or bad. The Florentine statesman, Machiavelli, in his book THE PRINCE advocated this doctrine. According to him, it is justifiable to go to any extent for achieving a good cause. It may be necessary to use violence sometimes. It will be harmful to some people. But all that can be justified if the goal is good. Some great Indian leaders and thinkers like Gandhi have opposed this doctrine. According to them it is not only necessary that goal should be