The Tokyo and Nuremberg trials were based on the notion that there were universal laws and principles which members of all nations were bound to obey. With their decisions, the tribunals helped enshrine that principle, maintaining that such international laws were superior to national laws, or military orders. Ultimately, their legitimacy was established by the Allied victory in the war and by an agreement among Great Britain, the Soviets and the Americans known as the London Agreement. Because the Axis powers had surrendered unconditionally, the victorious Allies had jurisdictional authority within their borders. The courts also refused to consider any parallels between Allied conduct of the war and that of the accused.
But the legitimacy of the courts was bolstered by the fact that they had trials at all. Allied leaders had toyed with the idea of summarily executing people they deemed to be war criminals, but by putting them on trial instead, they reinforced the idea of rule of law. But there was some question about whether the crimes they sought to prosecute were actually ex post facto offenses, i.e. made illegal after they had been committed. These questions were generally sidestepped, especially by the Tokyo tribunal.