It is extremely difficult to make an informed determination on the legality of U.S. military interventions.
The Founding Fathers placed a high priority on preventing the development of a dictatorship. Central to that goal was the establishment of a system of government in which checks and balances among the three branches -- Executive, Legislative, and Judicial -- would preclude the ability of any one branch from becoming too powerful. That approach to forming a governement was reflected in how the drafters of the Constitution divided the authorities to conduct foreign policy, to oversee and use the armed forces, and to control the federal budget.
The Constitution vests authority for declaring war against a foreign nation to the Congress. It, and it alone, can make such declaration. The Constitution also designates the president, as Chief Executive, the commander-in-chief of the armed forces. That individual alone can actually send military forces into harms way. Even though Congress can declare war, or not declare it, only the president can order the military into action.
In theory, that system of governance was supposed to preclude the president from being able to go to war without congressional consent. In practice, presidents from both major political parties have often deployed military forces abroad without any such declaration. Through the use of their powers as commander-in-chief, presidents have sent troops into combat situations many times.
The Congress has formally declared war only five times in our history: the War of 1812, the Mexican-American War of 1846, the Spanish-American War, and World Wars I and II. Such a list, however, assumes that the wording of congressional resolutions that do not specifically say "war" do not constitute formal declarations of war for legal purposes. In fact, Congress routinely authorizes presidents to use military force to respond to aggression abroad without using the politically charged word "war" in the text of the legislation. Over 50,000 Americans died in the Korean War of 1950-1953, yet it was not a congressionally-declared war. It was, however, legal under international law by virtue of the United Nations Security Council having passed resolution UNSCR 84, authorizing the international community to intervene after the North invaded the South.
The most divisive conflict in U.S. history was the war in Vietnam. Once again, there was no formal declaration of war by Congress, yet, by the time the war ended, over 58,000 Americans were dead, not to mention hundreds of thousands of Vietnamese, Laotians and Cambodians. Whether one considers the war in Vietnam to have been illegal is entirely dependent upon how one wishes to interpret what was known as the Tonkin Gulf Resolution, which authorized President Johnson to respond to allegations of North Vietnamese attacks on U.S. naval ships in the waters of the coast of Vietnam.
After the war in Vietnam ended, Congress attempted to regain control over the ability of the country to go to war by passing the War Powers Resolution of 1973. The failure of that law has been evident in the many conflicts in which the U.S. has found itself since then.
Most recently, the U.S. wars in Iraq and Afghanistan did not follow official or formal declarations of war by Congress, but in both instances Congress passed resolutions authorizing the use of force, although interpretations of the application of these resolutions have differed greatly.