Home of the ancient city of Carthage, Tunisia was once an important player in the Mediterranean, placed as it is in the centre of North Africa, close to vital shipping routes.
In their time, the Romans, Arabs, Ottoman Turks and French realised its strategic significance, making it a hub for control over the region.
French colonial rule ended in 1956, and Tunisia was led for three decades by Habib Bourguiba, who advanced secular ideas. These included emancipation for women - women's rights in Tunisia are among the most advanced in the Arab world - the abolition of polygamy and compulsory free education.
Mr Bourguiba insisted on an anti-Islamic fundamentalist line, while increasing his own powers to become a virtual dictator.
At a glance
- Politics: Tunisia has been in transition since President Zine al-Abidine Ben Ali was ousted in January 2011. The Islamist Ennahda party had to hand over power to an interim government ahead of elections in late 2014, at which secular parties triumphed
- Economy: The diverse economy has grown steadily and the slum population has halved, but the world recession has pushed unemployment up in recent years
- International: Tunisians are estimated to make up the biggest number of foreign fighters in Syria. Tunisia has strong ties with the European Union; its peacekeepers have served in several conflict areas
Country profiles compiled by BBC Monitoring
In 1987 he was dismissed on grounds of senility and Zine al-Abidine Ben Ali became president. He continued with a hard line against Islamic extremists, but inherited an economically-stable country.
Although Tunisia under Mr Ben Ali introduced some press freedoms and freed a number of political prisoners, the authorities tolerated no dissent.
Mr Ben Ali faced reproach at home and abroad for his party's three "99.9%" election wins. The opposition condemned changes to the constitution which allowed him to run for re-election in 2004, and in 2009.
Discontent with his autocratic rule erupted in into mass street demonstrations which prompted Mr Ben Ali to step aside in 2011. This inspired uprisings across the region that became known as the Arab Spring.
Tunisia is more prosperous than its neighbours and has strong trade links with Europe. Agriculture employs a large part of the workforce, and dates and olives are cultivated in the drier areas. But unemployment is chronic in some regions.
Tourism is a key sector of the economy. Visitor numbers dropped following the 2011 uprising, but Tunisia hopes to win back many of the Europeans who flocked to its resorts every year.
Secular Tunisians, especially women, are worried about the growing influence of ultra-conservative Islamists since the uprising that toppled Mr Ben Ali. The Islamist Ennahda party, which took over the reins of power in October 2011, pledged tolerance but put pressure on the state-run media and proposed a constitution that would curtail women's rights.
The killings of two opposition politicians in 2013 led to a stand-off between Ennahda and its secular rivals, with opposition supporters taking to the streets to demand fresh elections. In October 2013, Ennahda agreed to step aside in favour of a non-partisan caretaker government. This prepared for fresh parliamentary and presidential elections in late 2014, at which the Islamists were defeated.
Militant Islamists have long been an issue of concern for the authorities. A suicide bomb attack on an historic synagogue in the resort of Djerba in 2002 killed 21 people. Suspected Islamists were killed in shoot-outs with security forces in 2006-7, and pro-al-Qaeda groups have been active on the Algerian border since 2012.