American critics of the United Nations often zero in on its lack of serious military capacity, citing peacekeeping failures in Bosnia and more recently in central and west Africa as examples of ineffective do-goodery gone wrong. Imagine their surprise, then, to learn that the UN was born amid nude scenes in a White House bathroom and that its primary purpose was as a war-fighting machine.

Conventional historical timelines date the UN's foundation from the San Francisco conference of April to October 1945, when the victors of the second world war effectively institutionalised a new global order. But as Daisy Suckley, the close confidant of Franklin Roosevelt, noted in her private diary, the idea first took definitive shape when the US president went to bed on 28 December, 1941.

The date is significant. Three weeks before, on 7 December, the Japanese had launched a surprise attack on the American naval base at Pearl Harbor, Hawaii. On 11 December, Germany and Italy declared war on the US. After nearly two years of awkward ambivalence as the world burned, America was, at last, unequivocally "in". A delighted Winston Churchill rushed to Washington and, taking up residence in the White House, spent days debating with Roosevelt how the new anti-Axis alliance would work and, crucially, what to call it.

"FDR got into his bed, his mind working and working," Suckley recorded. "Suddenly he got it – United Nations! The next morning, the minute he had finished his breakfast, he got onto his chair and was wheeled up the hall to WSC's [Churchill's] room. He knocked on the door, no answer, so he opened the door and went in ... He called to WSC and in the door leading to the bathroom appeared WSC, 'a pink cherub' (FDR said), drying himself with a towel and without a stitch on! FDR pointed at him and exploded: 'The United Nations!' 'Good!' said WSC."

Having decided on a name and dressed, the two leaders set about creating a robust international organisation that would not only win the war but sustain the peace and prevent the rise of future tyrannies through multilateral institutions, conventions and treaties. As Dan Plesch relates in his fascinating new book, America, Hitler and the UN: How the Allies won World War II and Forged a Peace, published this month by IB Tauris, Roosevelt's idea was also to persuade the hitherto inward-looking American people of their country's manifest destiny as a paramount international power with global duties and interests.

The first United Nations Declaration, drawn up by Roosevelt and Churchill and building on Roosevelt's famous Four Freedoms speech and the 1941 Atlantic Charter, was promulgated on 1 January, 1942. It was signed by Joseph Stalin's USSR, Chiang Kai-shek's China, various British Empire dominions and Nazi-occupied European countries, and a clutch of pro-Washington central American states.

Each government dedicated itself, first and foremost, to employ its "full resources, military or economic, against those members of the Tripartite Pact [the Axis] and its adherents with which such government is at war". They were engaged, they said, "in a common struggle against savage and brutal forces seeking to subjugate the world".

But foreshadowing the UN's more ambitious, postwar mandates, signatories also declared themselves "convinced that complete victory over their enemies is essential to defend life, liberty, independence and religious freedom, and to preserve human rights and justice in their own lands as well as in other lands." In this sentence was encompassed the history of the next 50 years.

One notable signatory was India, then still under British rule, but allowed at Roosevelt's insistence to act as an independent country. One notable absentee was France. Roosevelt could not abide Charles de Gaulle, the Free French leader, and continued to recognise the Vichy regime as the government of France until the liberation in 1944. In all, 26 countries signed the original declaration. The modern-day UN numbers 192 sovereign states.

Despite the earlier failure of the League of Nations (caused in large part by Washington's hostility), the idea of united nations joined in common cause against fascism proved immediately popular with an American public fearful of Japanese attacks on the US mainland, and with Europeans who for too long had faced the Nazis alone. The term "UN forces" was soon routinely substituted for "US", "British" or "Russian" forces in reports of allied military actions.

American newspapers of the period took up the theme, carrying headlines such as "United Nations Powers Reveal Plan for Smashing Blows at Hitler" (Olean Times-Herald, New York); and "United Nations Pledge International Body to Keep Peace after the War" (Brownsville Herald, Texas). The first United Nations day was widely celebrated in June, 1942, including a record-breaking parade in New York. It was publicly supported in London, at Churchill's behest, by the young Princess Elizabeth and the British royal family.

As Plesch relates, even Stalin was enthusiastic, optimistically instructing his generals to prepare for a 1942 UN march on Berlin. Typically, he tried to induce British foreign secretary Anthony Eden to agree postwar European spheres of influence a full three years before the war actually ended. Eden declined the offer.

As the war intensified, and then slowly began to turn in the allies' favour, the UN in all its aspects proved both a practical force and a rallying totem across what was termed the "free world". Commenting on the 1944 Normandy landings, a Times editorial declared portentously that, four years after Dunkirk, "the United Nations returned yesterday to the soil of France".

Only after 1945, when the "free world" fractured into eastern and western camps, symbolised by Churchill's image of an Iron Curtain dividing Europe, did the UN's promise collide with the new postwar realities.

With the US, Britain and the Soviet Union entrenched and already at odds in the new UN security council (it held its first meeting in London in January, 1946), it became clear that in overthrowing the old world order, a new order had been created that posed a whole new set of challenges – and some very old ones, too. Foremost among the latter was the question of when and whether to use military force.