Magyar tribes from Eastern Europe enter the area in 895 and establish the state of Hungary. In 1000 Hungary becomes the Kingdom of Hungary. During the upcoming centuries the Hungarians enlarge their territory over large parts of Central Europe. Hungary is invaded by the Ottoman Empire and is defeated in 1526. The northern and eastern parts of Hungary can avoid Ottoman rule.
They accept the Austrian Habsburgians as kings in 1526, so it joins a personal union with Austria. Gradualy the Ottomans are driven out of Hungary. In 1849 Hungary is formally annexed to Austria. In 1867 Austria is restyled into the Austro-Hungarian Monarchy, of with the Kingdom of Hungary is one of the two constituent parts ("Lands of the Holy Hungarian Crown").
After the defeat of Austria-Hungary in World War I, Hungary becomes independent as the parliamentary democratic Hungarian People's Republic in 1918. In 1919 communist seize power and establish the Hungarian Conciliar Republic, later renamed Hungarian People's Republic. Later that year a counter revolution succeeds and Miklós Horthy de Nagybánya becomes regent and dictator of Hungary. Hungary is formally the Hungarian Kingdom and after the treaty of Trianon Hungary loses large parts of its territory to Czechoslovakia, Romania, Croatia (later part of Yugoslavia) and Fiume. Hungary allies with Germany in World War II. At the end of the war Following an unsuccessful attempt to switch sides in 1944 Hungary falls under German military occupation. This brings the fascist leader Ferenc Szálasi to power.
In 1944/1945 Hungary is invaded by the USSR. In eastern parts of Hungary the Hungarian State is established, renamed Hungarian Republic in 1946. The provisional government, dominated by the Magyar Kommunista Párt (Hungarian Communist Party, MKP), is replaced in 1945 after elections which gave majority control of a coalition government to the agrarian Független Kisgazda, Földmunkás és Polgári Párt (Independent Smallholders', Peasants' and Civic Party, FKgP). The government institutes a radical land reform and gradually nationalizes mines, electric plants, heavy industries and some large banks. The MKP communists ultimately undermine the coalition regime by discrediting leaders of rival parties and through terror, blackmail and framed trials. In elections tainted by fraud in 1947 the leftist bloc gain control of the government. With USSR support, Moscow-trained Mátyás Rákosi begins to establish a communist dictatorship. In 1949 all opposition parties are forced to merge with the MKP to form the Magyar Dolgozók Pártija (Party of the Hungarian Workers, MDP). The country is renamed the 1949 Hungarian People's Republic. Rákosi is succeeded as prime minister in 1953 by the reformer Imre Nagy.
Nagy has to step down in 1954, but in 1956 the Hungarian people revolts against the communist regime and the Soviet oppression. Rákosi resigns as dictator and is succeeded as party leader dictator by Ernö Gerö. Pressure for change reache a climax when security forces fired on Budapest students marching in support of Poland's confrontation with the Soviet Union. The ensuing battle quickly grows into a massive popular uprising. Imre Nagy becomes prime minister and János Kádár replaces Gerö as party leader. Nagy dissolves the state security police, abolishes the one-party system, promises free elections and negotiates with the USSR to withdraw its troops. Later that year Nagy announces Hungary's neutrality and withdrawal from the Warsaw Pact. Consequently the USSR launches a massive military attack on Hungary. Some 200,000 Hungarians flee to the West.
Kádár defects to the USSR and forms a new government. He returns to Budapest and, with Soviet support, carries out severe reprisals. Thousands of people are executed or imprisoned. The MDP is renamed into Magyar Szocialista Munkáspárt (Hungarian Socialist Workers' Party, MSzP). In 1988 Kádár is replaced as general secretary of the MSzP by reform communist leader Károly Grósz.
In 1989 the communist give up power voluntarily and Hungary becomes a parliamentary democratic republic named Hungarian Republic. The communist party is reformed into the social-democratic Magyar Szocialista Párt (Hungarian Socialist Party, MSzP). The first free elections are won by populist, center-right and liberal parties. The Magyar Demokrata Fórum (Hungarian Democratic Forum, MDF) becomes the largest party and its leader József Antall becomes prime minister in a center-right coalition government. When Antall dies in 1993 Peter Boross becomes prime minister. The MSzP wins the elections of 1994 and Gyula Horn becomes prime minister. In 1998 the conservative Fiatal Demokraták Szövetsége (Alliance of Young Democrats. Fidesz) wins the elections and can form a cennter-right government under Viktor Orbán. In 2002 Hungary votes to return the coaltion of the MSZP and the liberal Szabad Demokraták Szövetsége (Alliance of Free Democrats, SzDSz) back into power. The new government, led by prime minister Peter Medgyessy, has a very slim majority in parliament following the closest elections of the post-communist era. Hungary joins the European Union in 2004.