The history of Hungary starts with Prince Geza, a member of the Arpad Dynasty who, aided by the Holy Roman Emperor, was able to transform the pagan Magyar tribes into a nation. Geza and his family were converted to Christianity; his son, Vajk, was soon baptized, his name changed to the Christian name Istvan (Stephen). When Geza passed away, it was Stephen's turn to rule Hungary. Three years later, in the year 1,000, he was crowned the first king of Hungary.Stephen started on a road of political and religious reform. On one hand, he expropriated the land of the pagan chiefs and built castles to protect the Hungarian territory. On the other hand, with the constant support of the church, he hastened the way to convert the people to Christianity; he built several churches, appointed bishops and archbishops, and brought foreign tutors to teach and educate the population. In just 38 years, King Stephen was able to give birth to a nation whose population was already looking forward to the West.When King Stephen died, however, there was internal unrest that destabilized the nation and made Hungary liable to constant invasion from its neighbouring countries. King Bela III, in the mid-12th century, was again able to unite the people and defeat the Byzantine Emperor. But in the 13th-century, the mighty Mongols invaded Hungary, devastated many towns and villages, and killed one third of the population. King Bela IV made every effort to rebuild the country, and although he built many castles and bastions, he was unable to find a solution to the problems of the barons and noblemen who were asking for more land. Once more, instability and anarchy were the order of the day. The Arpad Dynasty was quickly approaching its end.It was now the turn of Robert Karoly to rule Hungary. This able politician and statesman, a descendant of the French House of Anjou, succeeded in controlling the requests of the barons, and his diplomacy created new roads of cooperation between Hungary, Czechoslovakia, and Poland.Less than half a century later, however, the Turks were marching towards Hungary. Janos Hunyadi, who was regent of Hungary after the death of King Sigismund, succeeded in defeating the Turks. Soon after, he crowned his son, Matthias Corvinus, king of Hungary. King Matthias, who ruled from 1458 to 1490, introduced taxation for the noblemen and invested heavily in an army that was able, in a few years, to conquer Bohemia, Moravia, and some regions in Austria. Matthias was an able ruler who built new palaces, castles, and fortresses and restored defensive walls.In 1526, however, the Turks thrashed the Hungarian army. Thousands of soldiers died on the battlefield, along with bishops, noblemen, and the reigning king himself. The prosperity and independence Hungary was enjoying changed into colonization and despair. Buda castle was taken over by the Turks in 1541. Hungary was divided, the Turks dominating the central region while the Habsburgs of Austria were assigned to the west. Political unrest reigned everywhere for more than a century. It was only when Turkish power began to wane that a sign of a new age began to appear over the horizon.After a war with Austria that lasted 8 years, Hungary, under the leadership of Ferenc Rakoczi, negotiated the first treaty for independence. Although this was a complete failure, Rakoczi succeeded in uniting the Hungarian people, who made great steps forward culturally and socially when Maria-Theresa was crowned queen of Austria in 1740.