Defending the United States from invasion is the Primary Mission of American armed forces. (or at least it used to be) How can we send thousands to die defending Iraq, but say it is illegal for the same troop to defend America? That would be a bizarre ruling in the extreme.
Essentially a ruling along those lines would declare that American armed forces can only be used in defense of foreign nations, but cannot be used in defense of America. My God, that would invite every foreign power on Earth to invade, since they know that we cannot legally defend ourselves.