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 also increased his own powers to become a virtual dictator.
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.
Despite the country's firmly anti-extremist political culture, militant Islamists are an increasing matter of concern for the authorities.
A suicide bomb attack on an historic synagogue in the resort of Djerba in 2002 killed 21 people, and was followed by sporadic shoot-outs with security forces over the next ten years until 2015, when the Islamic State group launched two attacks on tourists at the Bardo Museum and the beach resort of Sousse, leaving more than 60 people dead.