Hungary during World War II was one of the nations to fight on the side of the Axis and Allied powers. Hungary relied on trade with Fascist Italy and Nazi Germany in the years leading up to the war. Hungary was pressured into the Axis Powers but also sought negotiations with the Allied Powers, a 'betrayal' that led to Hitler's occupation of the country. World War II was a low point for the nation, with both Germany and the USSR poised to lay waste to the less powerful nation.
From the start of the war, Hitler sought Hungary's support in the invasion of Yugoslavia. He promised the return of Hungarian territory in exchange for military support from the Hungarians. Prime Minister Teleki, finding no way to keep Hungary from becoming Germany's ally, committed suicide on April 3, 1941. Right-wing radical László Bárdossy replaced him. Bardossy sought to both assist Germany and keep Hungary independent from the nation that was quickly enveloping Europe. Under Hungarian Admiral Horthy, Hungary entered into war against the Soviet Union alongside Germany.
Over a hundred thousand Hungarians would die during the conflict against the USSR, and Germany would have them pulled from the front lines once Hungary no longer had an effective military.
Admiral Horthy would replace Bardossy with Miklos Kallay, a conservative who wished to free Hungary from Germany's oppression. In order to avoid occupation, Kallay quietly conducted negotiations with the UK and the US stating they would not fire on their aircrafts in exchange for no Allied bombardment on their cities.
The Germans, aware of these negotiations, occupied Hungary. Kallay was replaced by Dome Sztójay, a pro-Socialist leader. Hungary was ruled completely by force, with no more pretense of Hungarian sovereignty.
In September 1944 came a battle of conflicting interest between the USSR and Germany, with Hungary as the battlefield. The USSR invaded the country. Horthy told the nation he had signed an armistice with the Soviets, yet the Hungarian army continued to desperately fight them off. Germans kidnapped Horthy's son and forced him to abort the armistice with the Soviets. With Romanian help, the Russians encircled Budapest and forced a German and Hungarian surrender by February 1945. However, on December 31, 1944, during this battle, Hungary officially declared war on Germany.
As if to further confuse Hungary's alignment, Hungarian garrisons in Bavaria stood in parade formation to surrender to the passing American troops, yet other pro-German Hungarian units continued to fight for the Axis Powers. While often portrayed as just a pawn of either Germany or the USSR, Hungary was a very divided nation during World War II, where the only real issue agreed upon by the nation was Hungarian independence. Neither German occupation during the war nor Soviet occupation after the war allowed this to happen.
Sources: Wikipedia, Country Studies.us, History.com, Project MUSE