The United States played a leading role in the Bretton Woods and Yalta conferences, which signed agreements on new international financial institutions and Europe's postwar reorganization. As an Allied victory was won in Europe, a 1945 international conference held in San Francisco produced the United Nations Charter, which became active after the war. The United States and Japan then fought each other in the largest naval battle in history, the Battle of Leyte Gulf. The United States developed the first nuclear weapons and used them on Japan in the cities of Hiroshima and Nagasaki in August 1945; the Japanese surrendered on September 2, ending World War II.