The Second World War erupted when, on 1 September 1939, Nazi Germany invaded Poland. France quickly declared war on Germany, with much of the remaining countries in Europe following suit. United States President Franklin Delano Roosevelt, however, issued a proclamation of neutrality on 5 September. By the end of the year, the Soviet Union invaded Finland, and the Declaration of Panama warned belligerents away from Western Hemisphere seas south of Canada.

As the war expanded through 1940, Germany continued invading its neighbors: Denmark and Norway in April, then Holland, Belgium, Luxembourg, and France in May. The United States prepared for the inevitable conflict to come by instituting the Selective Service and Training Act, the first peacetime draft in its history, and in August, Germany began a campaign of aerial bombardment of the United Kingdom, culminating in the Battle of Britain in late October, of which Prime Minister Winston Churchill remarked, “Never before have so many owed so much to so few.” At this time, Germany also entered into a ten-year mutual defense treaty with the Empire of Japan and fascist dictator Benito Mussolini’s Italy, creating the Axis Powers.

By March 1941, the United States instituted the Lend-Lease Act, which was designed to aid any country whose continued existence was deemed to be in the vital interest of the United States. While officially neutral, this effectively lent American support to the Allies in their fight against the Axis. On 7 December, the Empire of Japan launched a surprise attack on Pearl Harbor, Hawaii, destroying much of the United States’ Pacific Fleet. Casualties totaled 2,280 killed, including sixty-eight civilians, and 1,109 wounded. Simultaneously, the Japanese forces attacked the Philippines, Guam, Midway, Hong Kong, and the Malay Peninsula. The next day, the United States Congress unanimously declared war on Japan, and on 11 December, Germany and Italy declared war on the United States.

The war continued to rage until 1945. On 12 April of that year, President Roosevelt, in the first year of an unprecedented fourth term, died and was succeeded by Vice President Harry S. Truman. On 7 May, after weeks under siege in Berlin, Germany surrendered unconditionally to the Allies following the suicide of Fuhrer Adolf Hitler, ending the war in Europe. In July, the Allies met at Potsdam to hammer out details of the new peace. In early August, the United States dropped leaflets over the Japanese city of Hiroshima, warning that it would obliterate the city if Japan didn’t surrender immediately. The Japanese refused, and days later, on 6 August, the U.S. dropped an atomic bomb on Hiroshima, followed by another on Nagasaki three days later. One hundred thousand people died immediately, and another 100 thousand would die in the months that followed. On 14 August, Japan surrendered to the United States, ending the Second World War. The Soviet Union and the United States began to occupy the Korean peninsula, which had been a Japanese colony, dividing it in half at the 38th Parallel; the Soviets formed and controlled North Korea, while the Americans did the same for South Korea. Meanwhile, back in the United States, the House Committee on Un-American Activites began investigating Socialists, Communists, and other individuals and organizations that it deemed “un-American,” and its own activities would soon lead to the Red Scare.

Soon after the war ended, 1946 saw the birth of the first electronic comptuer, ENIAC, which was developed by John Eckert and John Mauchly. In 1947, the National Security Act split the United States Army Air Corps into a new branch, the U.S. Air Force, and coordinated it with the Army and Navy in the Department of Defense, which replaced the Department of War. The NSA also created the National Security Council and the Central Intelligence Agency. The draft, which had been instituted in 1940, ended, and the Presidential Succession Act established that the Speaker of the House of Representatives as next in line for the presidency following the vice president, followed in turn by the president pro tempore of the Senate and then the cabinet members in order of the date on which each of their departments were established. Also that year, Air Force Captain Chuck Yeager made the first supersonic flight aboard the Glamorous Glennis, a U.S. Bell X-1 rocket plane, and on 4 July, a flying saucer reportedly crashed near Roswell New Mexico, but the Army Air Corps representatives there quickly changed their story, claiming instead that it was actually an experimental weather balloon.

The Selective Service Act of 1948 saw the reinstatement of the draft, requiring the registration of all men between the ages of 18 and 26, and would continue throughout the Cold War and beyond. The Cold War would intensify in late 1948 when the Soviet Union–opposing the unification of occupied Germany, which had been split into various sectors by the Allies following Germany’s defeat three years earlier–began a blockade that cut off West Berlin, controlled by the Americans, French, and British and located deep within Soviet-controlled East Germany, from the rest of West Germany. The U.S. and U.K. responded an airlift of food and supplies that lasted slightly less than a year; each day, up to eight thousand tons of supplies would be flown into the city. President Truman, a Democrat, was reelected to the presidency of the United States, narrowly defeating his Republican opponent, Dewey, despite predictions by the press of a Republican victory.

As the decade drew to a close in 1949, the nations of Western Europe and the United States created the North Atlantic Treaty Organization (NATO), to provide a unified defense system in the face of growing Soviet power in Eastern Europe. Meanwhile, Mauchly and Eckert, who had created the ENIAC computer a few years earlier, followed up on their success by creating BINAC, the first American electronic-stored program computer.