Foreign ministers from European and North African countries have gathered in Barcelona to discuss ways to fight terrorism and illegal immigration.

Spanish Prime Minister Mariano Rajoy opened the forum by saying that he believes "the Mediterranean unites us and does not separate us" and that jihadi terror is the biggest threat facing the continent.

Rajoy spoke Monday, three days after a Spanish judge jailed seven people arrested in a case involving alleged discussions about targeting a Jewish bookstore in Barcelona.

Europe has been hit by increasing waves of migration as Syrians and sub-Saharan Africans cross the Mediterranean in flimsy boats in a bid to get to Europe.

Migrants often enter Spain by scaling towering fences in the country's North African enclave of Melilla, surrounded by Morocco and the Mediterranean.