Hungarian nationalism emerged among intellectuals influenced by the Age of Enlightenment and Romanticism. It grew rapidly, providing the foundation for the revolution of 1848–49. There was a special focus on the Magyar language, which replaced Latin as the language of the state and the schools. In the 1820s, Emperor Francis I was forced to convene the Hungarian Diet, which inaugurated a Reform Period. Nevertheless, progress was slowed by the nobles who clung to their privileges (exemption from taxes, exclusive voting rights, etc.). Therefore, the achievements were mostly of a symbolic character, such as the progress of the Magyar language.
On 15 March 1848, mass demonstrations in Pest and Buda enabled Hungarian reformists to push through a list of Twelve Demands. The Hungarian Diet took advantage of the Revolutions of 1848 in the Habsburg areas to enact the April Laws, a comprehensive legislative program of dozens of civil rights reforms. Faced with revolution both at home and in Hungary, Austrian Emperor Ferdinand I at first had to accept Hungarian demands. After the Austrian uprising was suppressed, a new emperor Franz Joseph replaced his epileptic uncle Ferdinand. Joseph rejected all reforms and started to arm against Hungary. A year later, in April 1849, an independent government of Hungary was established.
The new government seceded from the Austrian Empire. The House of Habsburg was dethroned in the Hungarian part of the Austrian Empire, and the first Republic of Hungary was proclaimed, with Lajos Kossuth as governor and president. The first prime minister was Lajos Batthyány. Joseph and his advisers skillfully manipulated the new nation's ethnic minorities, the Croatian, Serbian and Romanian peasantry, led by priests and officers firmly loyal to the Habsburgs, and induced them to rebel against the new government. The Hungarians were supported by the vast majority of the Slovaks, Germans, and Rusyns of the country, and almost all the Jews, as well as by a large number of Polish, Austrian and Italian volunteers.
Many members of the non-Hungarian nationalities secured high positions in the Hungarian army, for example General János Damjanich, an ethnic Serb who became a Hungarian national hero through his command of the 3rd Hungarian Army Corps. Initially, the Hungarian forces (Honvédség) managed to hold their ground. In July 1849, the Hungarian Parliament proclaimed and enacted the most progressive ethnic and minority rights in the world, but it was too late. To subdue the Hungarian revolution, Joseph had prepared his troops against Hungary and obtained help from the "Gendarme of Europe", Russian Czar Nicholas I. In June, Russian armies invaded Transylvania in concert with Austrian armies marching on Hungary from western fronts on which they had been victorious (Italy, Galicia and Bohemia).
The Russian and Austrian forces overwhelmed the Hungarian army, and General Artúr Görgey surrendered in August 1849. The Austrian marshall Julius Freiherr von Haynau then became governor of Hungary for a few months and on 6 October ordered the execution of 13 leaders of the Hungarian army as well as Prime Minister Batthyány; Kossuth escaped into exile. Following the war of 1848–1849, the country sank into "passive resistance". Archduke Albrecht von Habsburg was appointed governor of the Kingdom of Hungary, and this time was remembered for Germanisation pursued with the help of Czech officers.