"We're concerned about the growing number of people affiliated with Daesh who, having been defeated in Iraq and Syria, are moving their activities to the Sahel and Libya. It's practically at our border," Alfonso Dastis said, using another name for the Islamic State group.
The vast, arid Sahel zone has in recent years become a breeding ground for jihadist groups -- some linked to Al-Qaeda and IS -- that European nations fear could pose a threat if left unchecked.
The so-called G5 Sahel countries -- Burkina Faso, Chad, Mali, Mauritania and Niger -- have been hit by jihadist attacks that claimed thousands of lives, displaced hundreds of thousands of people, and have crippled local economies and food security.
"It's clear that the security situation in Niger and Mali is not improving much," Dastis said.
Spain in December decided to more than double the number of its military personnel in Mali to 292 from 140. They are part of a European force that is training the Malian army.
Dastis said Madrid feared Islamist fighters could take advantage of the yearly mass movement of workers from North Africa through Spain on their way back to their homes in Europe to enter the continent illegally.
Each year millions of people from France, Germany and other northern European countries cross Spain to spend their holidays with family in North Africa.
"This is a cause for concern but we do not believe it is necessary to draw a link between terrorism and immigration," he said.
'Spain takes surveillance seriously'
To ensure there is no problem Spain "takes surveillance issues very seriously... when it comes to welcoming refugees and immigrants," the minister added.
Unrest in Libya has caused migrants to increasingly favour the western Mediterranean route to reach Europe, which involves making the sea crossing between North Africa and southern mainland Spain.
Last month 1,287 migrants reached Spain by crossing the Mediterranean, and 75 died in the attempt, according to the International Organization for Migration.
Spain is often accused by rights groups of immediately returning migrants who cross into the tiny Spanish territories of Ceuta and Melilla on the northern coast of Africa back to Morocco without giving them the chance to
But Dastis reiterated the government's argument that migrants who scale the border fences surrounding the two enclaves should not be considered as having reached Spanish territory.
The European Court of Human Rights said last year that Spain violated the rights of two African migrants who scaled the border fence around Melilla in 2014 and swiftly sent back to Morocco.
Migrants who scale the border fence with the aid of hooks often injure themselves on the barbed wire and are beaten back by police, according to images filmed by rights groups.