The Carpathian Basin, in which Hungary lies, has been populated by successive peoples for thousands of years. One such tribe was the nomadic Magyars, who reached the area as early as the mid-8th century. Known for their equestrian skills, the Magyars raided far and wide, until they were stopped by the Germans in 955. The defeat left the Magyar tribes in disarray, and later forced them into an alliance with the Holy Roman Empire. In the year 1000, the Magyar prince Stephen was crowned 'Christian King' Stephen I, with a crown sent from Rome by the pope, and Hungary, the kingdom and the nation, was officially born.
Stephen ruthlessly set about consolidating royal authority by expropriating land, establishing a system of counties, and evangelising the countryside. By the time of his death in 1038, Hungary was a nascent Christian culture, increasingly westward-looking and multi-ethnic.
The next two and a half centuries - during the reign of the House of Árpád - tested the new kingdom to the limit. The period was marked by constant struggles between rival claimants to the throne, and land grabs by powerful neighbours. Hungary's descent into anarchy was arrested only after Andrew III, the Árpád's last in line, died in 1301.
After the death of Andrew III, Hungary flourished. A succession of able rulers, beginning with Charles Robert and culminating in the golden reign of Matthias Corvinus, made the country one of Europe's leading powers. However, the death of Matthias in 1490 resulted in another setback. His successor Vladislav was unable to maintain royal authority, funds were squandered, and retrograde laws reduced the peasantry to serfdom.
In 1526, Hungary's motley army was crushed by the Ottoman Turks at the Battle of Mohács. The defeat marked the end of a relatively prosperous and independent Hungary, and sent the nation into a tailspin of partition, foreign domination and despair. Turkish occupation did little to improve the country, and resistance to their rule forced the Turks out in 1699.
The expulsion hardly created a free and independent Hungary. Instead, the country became a province of the Austrian Habsburg Empire. Thus began a period of enlightened absolutism. Hungary blossomed economically and culturally under the Habsburgs, but so did thoughts of nationalism.
In 1849, under the rebel leadership of Lajos Kossuth, Hungary declared full independence and the dethronement of the Habsburgs. The Habsburgs replied by quickly crushing the revolution and instigating a series of brutal reprisals. Hungary was again merged into the empire as a conquered province, and absolutism was reinstated. However, passive resistance among Hungarians and a couple of disastrous military defeats for the Habsburgs prompted negotiations between the two sides. The outcome was the Compromise of 1867, which created the Dual Monarchy of Austria the empire and Hungary the kingdom. This 'Age of Dualism' set off an economic, cultural and intellectual rebirth in Hungary, but there were worrying signs that all was not well in the kingdom.
The Dual Monarchy entered WW I as an ally of Germany - with disastrous results - and was replaced by a republic immediately after the war. Hungarian Communists then seized power, but were overthrown five months later by troops from Romania. In 1920, the Allies drew up a postwar settlement under the Treaty of Trianon which drastically reduced Hungary's size. Hungary sought help from the fascist governments of Germany and Italy to get its land back, but found itself again on the losing side in WW II.
In 1947, rigged elections brought the Communists to power. Bitter feuding within the party started, and purges and Stalinesque show trials became the norm. The nation was further rocked by the 1956 uprising, an anti-Soviet revolution that left thousands dead. After reprisals - the worst in the country's history - and the consolidation of the regime, János Kádár began a programme of 'goulash' (consumer-oriented) Communism. His reforms worked, and by the mid-1970s, Hungary was the most developed, most liberal and the richest nation in the region. However, the continuing spectre of unemployment, a soaring inflation rate and mounting debt meant Kádár was ousted in 1988.
After accelerating the collapse of Communism by dismantling the fence along its border with Austria, the nation became the Republic of Hungary in 1989. Hungary has since held free elections - the first in more than four decades. Despite initial success in curbing inflation and lowering interest rates, a host of economic problems has slowed the pace of development. In 1998 Hungary was hit by a wave of execution-style murders and bombings that police linked to organised crime. One of the victims was a police informer, blown up by a car bomb in a tourist district at midday, killing three bystanders. In April 1999, Hungary joined NATO and is set to become an EU member in 2003.