Hungary–Romania relations
During World War II, Hungary and Romania became allies and participated in the war against the Soviet Union. But after the coup on 23 August 1944 Romania switched sides and fought against Hungary. Consequently, Soviet and Romanian troops invaded Hungary, occupied Northern Transylvania by October 1944 and re-established the Romanian administration in the region in March 1945. The 1947 Treaty of Paris reaffirmed the borders between Romania and Hungary as originally defined in Treaty of Trianon 27 years earlier, thus confirming the return of Northern Transylvania to Romania.
Romania
Modern Romania was formed in 1859 through a personal union of the Danubian Principalities of Moldavia and Wallachia. The new state, officially named Romania since 1866, gained independence from the Ottoman Empire in 1877. Following World War I, when Romania fought on the side of the Allied powers, Bukovina, Bessarabia, Transylvania as well as parts of Banat, Crișana, and Maramureș became part of the sovereign Kingdom of Romania. In June–August 1940, as a consequence of the Molotov–Ribbentrop Pact and Second Vienna Award, Romania was compelled to cede Bessarabia and Northern Bukovina to the Soviet Union, and Northern Transylvania to Hungary. In November 1940, Romania signed the Tripartite Pact and, consequently, in June 1941 entered World War II on the Axis side, fighting against the Soviet Union until August 1944, when it joined the Allies and recovered Northern Transylvania. Following the war, under the occupation of the Red Army's forces, Romania became a socialist republic and member of the Warsaw Pact. After the 1989 Revolution, Romania began a transition back towards democracy and a market economy.