Immanuel Kant is a pretty important philosopher, but to laymen, his ideas aren't all that easy to understand. So here's a quick primer to his work that I swiped from Ron's Philosophy Page entitled Kant's Ethics: The Short Version:
- How would you like it if everybody did that?
- If you do something because you're a dick, but then it works out okay anyway, you're still a dick.
Secondly, Kant believes that you should not use people as a means to achieve an end. In other words, if you do something immoral, even if the end result is something good, then it was still an immoral act.
If you'd like to learn more about Kant's views on ethics, I suggest picking up The Great Philosophers, by Stephen Law. It does a good job at exploring Kantian ethics in some detail, without getting too technical (as well as explain the philosophies of 49 other great thinkers). Highly recommended book!