In March 1848, revolution erupted in Vienna, forcing Austria's Chancellor Klemens von Metternich to flee the capital. Unrest broke out in Hungary on March 15, when radicals and students stormed the Buda fortress to release political prisoners. A day later, the Diet's liberal-dominated lower house demanded establishment of a national government responsible to an elected parliament, and on March 22 a new national cabinet took power with Count Louis Batthyany as chairman, Kossuth as minister of finance, and Szechenyi as minister of public works. Under duress, the Diet's upper house approved a sweeping reform package, signed by Ferdinand, that altered almost every aspect of Hungary's economic, social, and political life. These so-called April Laws created independent Hungarian ministries of defense and finance, and the new government claimed the right to issue currency through its own central bank. Guilds lost their privileges; the nobles became subject to taxation; entail, tithes, and the corvee were abolished; some peasants became freehold proprietors of the land they worked; freedom of the press and assembly were created; a Hungarian national guard was established; and Transylvania was brought under Hungarian rule.
The non-Magyar ethnic groups in Hungary feared the nationalism of the new Hungarian government, and Transylvanian Germans and Romanians opposed the incorporation of Transylvania into Hungary. The Vienna government enlisted the minorities in the first attempt to overthrow the Hungarian government. Josip Jelacic--a fanatic anti-Hungarian--became governor of Croatia on March 22 and severed relations with the Hungarian government a month later. By summer the revolution's momentum began to wane. The Austrians ordered the Hungarian diet to dissolve, but the order went unheeded. In September Jelacic led an army into Hungary. Batthyany resigned, and a mob lynched the imperial commander in Pest. A committee of national defense under Kossuth took control, authorized the establishment of a Hungarian army, and issued paper money to fund it. On October 30, 1848, imperial troops entered Vienna and suppressed a workers' uprising, effectively ending the revolution everywhere in the empire except Hungary, where Kossuth's army had overcome Jelacic's forces. In December Ferdinand abdicated in favor of Franz Joseph (1848-1916), who claimed more freedom of action because, unlike Ferdinand, he had given no pledge to respect the April Laws. The Magyars, however, refused to recognize him as their king because he was never crowned.
The imperial army captured Pest early in 1849, but the revolutionary government remained entrenched in Debrecen. In April a "rump" Diet deposed the Habsburg Dynasty in Hungary, proclaimed Hungary a republic, and named Kossuth governor with dictatorial powers. After the declaration, Austrian reinforcements were transferred to Hungary, and in June, at Franz Joseph's request, Russian troops attacked from the east and overwhelmed the Hungarians. The Hungarian army surrendered on August 13, and Kossuth escaped to the Ottoman Empire. A period of harsh repression followed. Batthyany and about 100 others were shot, several society women were publicly whipped, and the government outlawed public gatherings, theater performances, display of the national colors, and wearing of national costumes and Kossuth-style beards.
After the revolution, the emperor revoked Hungary's constitution and assumed absolute control. Franz Joseph divided the country into four distinct territories: Hungary, Transylvania, Croatia-Slavonia, and Vojvodina. German and Bohemian administrators managed the government, and German became the language of administration and higher education. The non-Magyar minorities of Hungary received little for their support of Austria during the turmoil. A Croat reportedly told a Hungarian: "We received as a reward what the Magyars got as a punishment."
Hungarian public opinion split over the country's relations with Austria. Some Hungarians held out hope for full separation from Austria; others wanted an accommodation with the Habsburgs, provided that they respected Hungary's constitution and laws. Ferencz Deak became the main advocate for accommodation. Deak upheld the legality of the April Laws and argued that their amendment required the Hungarian Diet's consent. He also held that the dethronement of the Habsburgs was invalid. As long as Austria ruled absolutely, Deak argued, Hungarians should do no more than passively resist illegal demands.
The first crack in Franz Joseph's neo-absolutist rule developed in 1859, when the forces of Sardinia and France defeated Austria at Solferno. The defeat convinced Franz Joseph that national and social opposition to his government was too strong to be managed by decree from Vienna. Gradually he recognized the necessity of concessions toward Hungary, and Austria and Hungary thus moved toward a compromise. In 1866 the Prussians defeated the Austrians, further underscoring the weakness of the Habsburg Empire. Negotiations between the emperor and the Hungarian leaders were intensified and finally resulted in the Compromise of 1867, which created the Dual Monarchy of Austra-Hungary, also known as the Austro-Hungarian Empire.