In the lead up to the Iraq war, and to a lesser degree in the discussion before the military action in Libya in 2011, there was much discussion in the United States about the possibility that any action would be a preemptive war/war of aggression. Is such an action itself illegal in the United States or any other country, or just something that would be politically untenable for a western democracy? If it is illegal, is that the result of a treaty or federal statute? Are there other countries that have different laws with respect to preemptive war?
To use the word "illegal" presumes that there is an authority which has the ability to state what is "legal" and what is not. The present world system operates on agreement and consensus, but only has as much power as the member states choose to cede to it.
There are several treaties and conventions (UN High Charters, Geneva Convention, etc...) but these do not have any more force of law than countries choose to give it. If they withdraw from any convention or treaty, there would be public censure, but no actual "legal" action that an authority could take. Whether or not the 'rest of the world' chose to go after such a state is a different matter, but that is diplomatic action, again, not 'legality.'
The United States, for example, has not signed on to the International Court of Justice (for fear that its soldiers may be prosecuted). As such, if a foreign country wants to prosecute an American soldier, the only authority it has to do so is the authority that United States allows the other country. Likewise, the United States refused to participate in the League of Nations, and thus could and would ignore its actions.
Technically, the Kellogg-Briand Pact outlawed war - in 1928. It was just a treaty. See how effective it was?
The situation could be likend to membership in a church. Churches can, in theory, can impose punishment on its members - but because people are free to join and leave churches as they choose, in practice there is no church discipline. A member who violates the agreed upon rules can be censured or expelled, but beyond that, there is no power to force or compel.
States that enter into "illegal wars" can be censured, sanctioned, yelled at very, very, loudly - and if the rest of the world so decides - invaded or attacked. That said, that isn't a matter of legality. It's a matter of force. As Clausewitz said - "War is just Diplomacy by other means."
There is no federal US statute that says anything about legality or illegality of "preemptive" war. All that's needed for war to be "legal" is following Article One, Section Eight of the Constitution (practical details listed on the Wiki) and/or possibly War Powers resolution (as far as I know, the latter was never actually tested in front of Supreme Court, and many Presidents ignored it - see Wiki - while Congress insists on it).
In other words, if Congress declares war on innocent nation X, that is fully legal inside USA. Mind you, that may cost some people re-election if enough people object to such an action.
As far as treaties and international law, a very thorough treatement can be found here: http://www.dcbar.org/for_lawyers/resources/publications/washington_lawyer/january_2003/war.cfm
A short version of that article is basically "it's fuzzy and mostly depends on which expert you ask to interpret things"
The main law which seems to apply is UN Charter article 51:
“Nothing in the present charter shall impair the inherent right of individual or collective self-defence if an armed attack occurs against a Member of the United Nations….”
The rest is, basically, lawyering and semantics. Historically, self-defense was usually applied to preemptive attacks when the target's threat was imminent; however the "what is imminent" obviously changed in practice from early 1900s when you could observe massed troops to 2010 when you have technology suitcase nukes (or a cargo ship with a nuke onboard); or tactics like civilian airplanes used as weapons.
Again, there is no clear unambiguous law or treaty on the topic, it's all highly dependant on interpretation of fairly vague clauses.
I'm fairly certain that Germany and Japan post-WWII had laws to the effect that the military may only be used for defensive purposes. Again, the devil is in the detail - "defensive" can be interpreted quite broadly, as it actually WAS in Germany post-1990.
The role of the Bundeswehr is described in the Constitution of Germany (Art. 87a) as absolutely defensive only. Its only active role before 1990 was the Katastropheneinsatz (disaster control). Within the Bundeswehr, it helped after natural disasters both in Germany and abroad. After 1990, the international situation changed from East-West confrontation to one of general uncertainty and instability. Today, after a ruling of the Federal Constitutional Court in 1994 the term "defense" has been defined to not only include protection of the borders of Germany, but also crisis reaction and conflict prevention, or more broadly as guarding the security of Germany anywhere in the world
"Planning, preparation, initiation or waging of a war of aggression or a war in violation of international treaties, agreements or assurances" is the crime against peace, and it's not important, what are the laws of particular country. The officials of such country can be prosecuted by any other country as war criminals.
You can see http://deoxy.org/wc/wc-ilaw.htm or anything similar, the best are printed academic publication, but I have them only in Polish, so I can't cite them directly here :)
However, the 'preemptive war' is a tricky term, because it suggest self-defense which is not forbidden by international laws. The problem is, how to define self-defense and where is the border between preemptive self-defense and the aggression.
The term 'war' may be used internally, especially in political campaigns, but on international level it is avoided and the term 'intervention' is often used. Especially 'humanitarian intervention'. In Libya there was the civil war, so it was easy to present one side as innocent victims and the other as oppressors and use it as pretext for intervention.
No, preemptive war is not illegal, if a court is unbiased, it should aquite a person who ordered a preemptive war given the person proves that the other side was preparing a war of aggression.
Yet this is not applicable to Libya, because it was not preparing a war against the US, and the US even did not claim so. Waging pre-emptive war is only allowed with the aims of self-defense against an inevitable attack.