Spain and Mauritania have agreed measures aimed at reducing illegal immigration from Mauritania to the European Union (EU).
Hundreds of North African immigrants attempt to reach Europe across the Mediterranean
Spanish Foreign Minister Ana Palacio and her Mauritanian counterpart, Mohamed Ould Tolba, signed an accord that will allow Spain to return illegal immigrants to Mauritania even if they are citizens of another country.
Correspondents say that Mauritania itself is not a significant source of illegal immigration to the EU.
But they say the country serves as a transit territory for people from other countries, especially from Senegal and Mali who enter Europe through Spain's Canary Islands, which is near Mauritania's coast.
Spain estimates that there are about 600,000 illegal immigrants currently living in the country, most of them from Latin America and North Africa.
Ms Palacio said that while promoting legal immigration, the EU has a responsibility to combat "trafficking in human beings".
The largest source of African migrants in Spain is Morocco.
People often drown as they cross the Straits of Gibraltar, which separates the two countries.
In June, a boat packed with hundreds of African immigrants heading for Italy sank off the Tunisia, with only 41 of an estimated 250 believed aboard to have survived.
Survivors said they had paid agents in Libya for their passage to Europe across Mediterranean.
Italy, which has taken over the EU presidency for the next six months, has made immigration policy and border control a top priority.