During World War II, the Kingdom of Hungary was a member of the Axis powers. In the 1930s, the Kingdom of Hungary relied on increased trade with Fascist Italy and Nazi Germany to pull itself out of the Great Depression. By 1938, Hungarian politics and foreign policy had become more stridently nationalistic, and Hungary adopted an irredentist policy similar to Germany's, attempting to incorporate ethnic Hungarian areas in neighboring countries into Hungary. Hungary benefited territorially from its relationship with the Axis. Settlements were negotiated regarding territorial disputes with the Czechoslovak Republic, the Slovak Republic, and the Kingdom of Romania. In 1940, under pressure from Germany, Hungary joined the Axis. In 1941, Hungarian forces participated in the invasion of Yugoslavia and the invasion of the Soviet Union.
While waging war against the Soviet Union, Hungary engaged in armistice negotiations with the United States and the United Kingdom. Hitler discovered this betrayal and, in March 1944, German forces occupied Hungary. When Soviet forces began threatening Hungary, an armistice was signed between Hungary and the USSR by Regent Miklós Horthy. Soon after, Horthy's son was kidnapped by German commandos and Horthy was forced to revoke the armistice. The Regent was then deposed from power, while Hungarian fascist leader Ferenc Szálasi established a new government, with German backing. In 1945, Hungarian and German forces in Hungary were defeated by invading Soviet armies.