Hungary traces its history back to the Magyars, an alliance of semi-nomadic tribes from southern Russia and the Black Sea coast that arrived in the region in the ninth century.
After centuries as a powerful medieval kingdom, Hungary was part of the Ottoman and then Habsburg empires from the 16th century onwards, emerging as an independent country again after the First World War.
After decades under Communist rule, Hungary's status as a liberal democracy and member of the European Union has been questioned by the increasingly authoritarian actions of populist right-wing Prime Minister Viktor Orban.
A landlocked country, Hungary is home to Lake Balaton, the largest in central Europe, and to a large number of spa towns and hot springs.
President: Janos Ader
A lawyer and member of the European Parliament for Hungary's governing Fidesz party, Janos Ader was elected president in 2012 in a parliamentary vote that was boycotted by the main opposition Socialist Party.
He is closely associated with the controversial policies of Prime Minister Viktor Orban, and helped draft changes to election laws and the role of the judiciary that prompted complaints from the European Commission.
Prime minister: Viktor Orban
Viktor Orban has concentrated an unprecedented amount of power in his hands while alarming other EU leaders with his brand of nationalist populism.
He has described his goal for Hungary as creating an "illiberal state", and argues that authoritarian systems like those in China, Turkey and Russia are a more appropriate model than Western liberal democracies.
He won a third straight term in power in elections in April 2018 after his anti-immigration campaign message secured a strong majority for his Fidesz party in parliament, granting him two-thirds of the seats.
The rightwing nationalist prime minister projected himself as a saviour of Hungary's Christian culture against Muslim migration into Europe.
However, the election left Hungary a divided country - Orban's party got its votes from older voters and the countryside, while cities and the young voted for change.
The governing Fidesz party has taken steps to bolster its media influence.
Hundreds of pro-government media outlets formerly owned by business figures loyal to Prime Minister Orban have merged to form a conglomerate.
Nonetheless, Reporters Without Borders says the media landscape is varied, with online outlets engaging in investigative reporting.
Some key dates in Hungary's modern history:
1867 - Hungary becomes equal partner in Austro-Hungarian Empire.
1918 - Austro-Hungarian Empire is broken up at the end of First World War. A Hungarian republic is proclaimed following a revolution.
1919 - Communists take over power under Bela Kun. Kun wages war on Czechoslovakia and Romania. Romanian forces occupy Budapest and hand power to Admiral Miklos Horthy.
1920 - Under the Treaty of Trianon, Entente powers award more than two-thirds of Hungarian territory to Czechoslovakia, Romania and Yugoslavia, leaving a third of Hungarian speakers living outside the country.
1920s-1930s - Admiral Horthy's rule is characterised by bitter resentment at loss of Hungarian territories, becomes progressively more reactionary and more closely allied with Nazi Germany.
1941-1945 - Hungary fights on the side of Nazi Germany in Second World War, losing a large part of its army in Russia. The Germans occupy Hungary in in 1944 after Hungary seeks an armistice. Hundreds of thousands of Jews and gypsies are deported to death camps.
1947-49 - Communists consolidate power under the Soviet occupation, with a new constitution, the nationalisation of industry, collectivised agriculture and mass terror.
1956 - An uprising against Soviet domination suppressed by the Soviet Army. Janos Kadar becomes head of government.
1989-91 - Fall of communism after the opening of the border with Austria to allow thousands of East Germans escape to the West. Democratic elections are held and Soviet forces withdraw from Hungary.
1999 - Hungary joins Nato.
2004 - Hungary is one of 10 new states to join the EU.
2010 - Populist right-wing Prime Minister Viktor Orban consolidates power with increasingly authoritarian measures.