Spain's maritime rescue service says it has picked up 339 migrants from seven boats trying to cross the Mediterranean Sea from Morocco.

The rescue service says the migrants were taken by three maritime rescue ships to Spain's southern town of Tarifa, located across the Strait of Gibraltar from Morocco. The migrant boats were intercepted separately early Wednesday.

The service said one boat had 34 migrants from sub-Saharan African countries. It said the rest of the migrants were from the Maghreb countries of northwest Africa.

Tens of thousands of migrants from Africa attempt the perilous crossing to Europe in smugglers' boats each year and thousands drown along the way.