Hungary fought with both the Axis powers and the Allies in World War II. At the beginning of the war, Hungary's regent Miklas Horthy attempted to keep Hungary out of the war. Hungary's treaty commitments called for Hungary to assist Germany if Germany was attacked, but did not otherwise obligate Hungary to become involved in the war. Hungary had a long history of friendship with Germany and enmity with Russia.

With the Axis

Hungary joined the Anti-Comintern Pact -- a treaty whose stated purpose was to prevent the influence of the international communist movement -- with Germany, Japan and Italy in 1939 as a means of protecting itself from perceived danger from the Soviet Union. Under pressure from Germany, Hungary actively joined the war in 1941, declaring war on the USSR. Later that year, Hungary also declared war on the United States and Great Britain. Hungary's military was effectively neutralized by the Soviets in January 1943 at the Battle of Voronezh in the western Soviet Union.

With the Allies

As early as 1942, the Hungarian government made overtures toward the western Allies, suggesting that Hungary was willing to switch sides if the Allies could promise Hungary protection from Germany and the Soviet Union. When Adolf Hitler learned of this in October 1944, he replaced Hungarian officials with a German-controlled puppet government. This government carried out Hitler's bidding until it was overthrown by Soviet forces -- who installed a government friendly to the Soviets -- in December 1944. The new communist government of Hungary declared war on Germany on December 31, 1944.