One of Africa's newest oil producers, Mauritania bridges the Arab Maghreb and western sub-Saharan Africa.
The largely-desert country presents a cultural contrast, with an Arab-Berber population to the north and black Africans to the south. Many of its people are nomads.
In the Middle Ages Mauritania was the cradle of the Almoravid movement, which spread Islam throughout the region and for a while controlled the Islamic part of Spain.
European traders began to show interest in Mauritania in the 15th century. France gained control of the coastal region in 1817, and in 1904 a formal French protectorate was extended over the territory.
Morocco opposed the country's independence in 1960 and for a time tried to absorb it. But Morocco's King Hassan II later improved ties as part of his plan to divide Western Sahara.
At a glance
- Politics: Mauritania has experienced several coups since independence in 1960. The current president led the latest coup in 2008, and subsequently won elections
- Economy: Mauritania is Africa's second biggest exporter of iron ore and an oil producer. Its waters are reputed to have some of the most abundant fish stocks in the world
- International: Mauritania has been working with the West to combat Islamist militancy in the Sahel region
Country profiles compiled by BBC Monitoring
The eventual deal in 1976 brought more problems, though, with Mauritania coming under attack by Polisario Front guerrillas, who opposed Moroccan control of Western Sahara, and the subsequent downfall of the leader since independence - Moktar Ould Daddah - in a military coup.
Peace was agreed with the Polisario in 1979, but this in turn worsened relations with Morocco, until a detente in 1985. More recently, ties with Senegal have been strained over the use of the Senegal River, which forms the border between the two countries.
Mauritania has over the years been criticized for what human rights organisations say is the persistence of slavery, which the government denies.
The organisation Walk Free in 2015 ranked Mauritania at the top of its Global Slavery Index, saying slaves constitute a higher proportion of the population than elsewhere. It says more than 150,000 people are enslaved in Mauritania, or 4% of the population, compared with India's 14 million, or 1% of the population.
In 2014 a UN special rapporteur on slavery hailed Mauritania's progress in the fight against slavery but called on the authorities "to take more vigorous measures to eliminate slavery and to fully implement the laws and policies."
Biram Ould Abeid, a prominent anti-slavery activist who was awarded a UN Human Rights Prize in 2013, was imprisoned in 2014, and the human rights organisation Amnesty International says ''anti-slavery activists are subject to never ending harassment and intimidation''.
One of the world's poorest countries, Mauritania is rich in mineral resources. According to the World Bank it is Africa's second biggest exporter of iron ore, it is a modest oil producer with considerable natural gas deposits and its waters have some of the most abundant fish stocks in the world.
The country forged diplomatic ties with Israel in 1999, one of three Arab nations to have done so, but severed them in 2009 in protest at Israel's then military operation in Gaza.
Mauritania is seen by the West as a valuable ally in the fight against Islamist militancy in the Sahel region.
While there were some high-profile cases of foreigners being kidnapped or murdered in the late 2000s, EU has praised the government for making the country and wider region more stable.
However, the governments of France, the United States and Britain still have travel warnings in place, advising against all but essential travel in the south-east and against all travel to the rest of the country.