Scattered reports that Islamic State group sympathizer Amedy Coulibaly spent time in Madrid with wife and purported accomplice Hayat Boumeddiene just days prior to his deadly assault on a Paris kosher supermarket this month have raised new questions regarding Spain’s anti-terror efforts. The nation devoted massive resources to combat radical elements after the 2004 Madrid train bombings that left nearly 200 people dead, and it has largely avoided the rash of “lone wolf” attacks that have plagued Western Europe in recent years.

But Coulibaly’s time in Madrid, coupled with Boumeddiene’s purported escape from Madrid to Syria prior to the Jan. 7 Charlie Hebdo shootings, highlighted the ease with which militants are able to pass through Spanish and, to a larger extent, European borders. The nation has dealt with a rash of illegal immigration in recent years, as well as a disproportionate level of conflict with radical Islamist elements given its relatively small Muslim population.

“Spain finds itself in the same situation as all the other European countries with all the returning jihadists. It’s very hard to keep track of all these guys. There’s just not enough manpower, I think, to do that,” said Soeren Kern, a distinguished senior fellow at the Gatestone Institute in New York City.

Coulibaly, a 32-year-old French national of Malian descent, coordinated with the Kouachi brothers to carry out the shootings that left 17 dead in Paris earlier this month. A self-professed supporter of the radical Islamic State group, Coulibaly gunned down several hostages before French security forces were able to kill him.

French and Spanish authorities were working together to investigate reports that Coulibaly, Boumeddiene and a third, as yet unknown accomplice stayed in Madrid from Dec. 30 to Jan. 2. The investigation centers on whether Coulibaly received operational support for the Paris attack while in Madrid, according to the Guardian.

“I suspect, although it’s very early and impossible to say definitively, that the purpose of that trip was either to get their stash of weapons or to facilitate the departure of Hayat out of the country,” said Max Abrahms, a terrorism theorist with the Council on Foreign Relations in New York City.

While authorities have yet to elaborate on what they suspect Coulibaly did during his time in Madrid, Boumeddiene’s timeline appears relatively solidified. Surveillance footage showed Coulibaly’s 26-year-old common-law wife and an identified accomplice arriving at a Turkish airport on Jan. 2, which meshes with her suspected time in Spain. Turkish Foreign Minister Mevlut Cavusoglu told state media Boumeddiene flew from Madrid. She had a return ticket to Madrid that went unused, Sky News reported.

That Coulibaly and Boumeddiene were able to evade detection days before carrying out a mass casualty event in Europe is a source of obvious concern for Spain. Aside from a High Court probe into the couple’s movements, top Spanish officials have proposed modifications to the Schengen treaty – a longstanding agreement that allows citizens to move freely through 26 European nations without submitting to passport checks. The border between France and Spain is particularly porous, Kern said.

“We are going to back border controls and it is possible that as a consequence it will be necessary to modify the Schengen treaty,” Spain’s Interior Minister Jorge Fernandez Diaz told El Pais on Jan. 11, according to AFP. “The existing mobility in the European Union is facilitating the movements (of jihadists) to any country and also to our country.”

The possibility of unhindered movement is worrisome for European nations scrambling to combat the growing threat posed by jihadists who recently returned to their home countries after fighting in Syria and Iraq. Hundreds of such fighters flooded Europe in recent months, many crossing the border into Turkey, then flying back to their birth nations to carry out self-contained “lone wolf” attacks. Some reports suggested the Cherif brothers received training overseas before the Charlie Hebdo shooting, particularly in light of Yemen’s al Qaeda in the Arabian Peninsula’s claim of responsibility for the attack.

Britain, France, Germany and Belgium have launched raids and arrested dozens of radical Islamists on domestic soil in recent months. Each of these nations has provided military aid to the United States in its fight against the Islamic State group and faces the challenge of identifying potential threats that lie hidden among sizable, mostly peaceful Muslim communities.

The face of Spain’s fight against terrorism is different. Spain has a smaller Muslim community than many of its European neighbors, with adherents to Islam composing approximately 2 percent of the nation’s population, as of 2010, according to The Guardian.

Spain has spoken out against the Islamic State group, but has not directly participated in military action against the militant faction in Iraq and Syria, the New York Times notes. Moreover, Spain has largely avoided the specter of returning jihadists.

Diaz recently said that 70 nationals who left Spain to fight overseas returned to Spanish soil in 2014, with about a dozen more returning after the New Year. By comparison, French authorities said in December that nearly 200 returned fighters were known to be on domestic soil. The problem is so pervasive in the U.K. that Prime Minister David Cameron enacted special measures to prevent known jihadists from entering or leaving the country.

On the North African coast, the Spanish enclaves of Melilla and Ceuta continue to complicate the nation’s counterterrorism efforts. Though they are technically part of Spain, the two territories share a border with Morocco on the African mainland. Would-be immigrants from the impoverished nations of Mali and Cameroon are just a fence jump and a ferry ride away from the relative prosperity of Europe. The same is true for Islamist elements looking to exploit the Strait of Gibraltar for discreet passage into Europe.

Spain spent tens of millions of euros a decade ago to build security barriers between the enclaves and neighboring Morocco, and millions more to fortify those barriers in 2014, The Guardian reported. Still, the expenditures failed to prevent more than 5,000 illegal immigrants from entering the enclaves through the first nine months of 2014. To combat these waves of humanity, Spain turned to summary deportation, in violation of European Union law and despite strong criticism by human rights officials.

Given the presence of hardline Islamist groups like Boko Haram and noted sympathy for the Islamic State group within Africa, illegal immigration through the Spanish enclaves is a security concern not only for Spain, but for all of Europe. Morocco alone accounts for between 1,500 and 2,000 fighters in Iraq and Syria, authorities said. Returning jihadists who cannot fly back to their home countries due to placement on watch lists can fly into Morocco, hop the fence into the enclaves, and then obtain passage by ferry back to Europe.

Spanish authorities are aware of this connection and have stepped up counterterrorism efforts in Melilla and Ceuta over the last year. In one major operation, local police arrested six Spanish men in Melilla last May for recruiting Islamists to fight in Syria, Libya and Mali, CNN reported. In September, Spanish and Moroccan security forces teamed up to arrest nine individuals who were affiliated with a North African terrorist organization with ties to the Islamic State terror group.

“A lot of the Muslims in France are from Morocco and Northern Africa. What they do is they usually drive down to Gibraltar or down to near the southern part of Spain to get the ferry boats to cross the Strait of Gibraltar. So there’s a lot of traffic between French Muslims and Northern Africa, and they’re always passing through Spain because of the geography,” Kern said.