MADRID (Reuters) - Spain and Morocco arrested 14 people on Tuesday suspected of recruiting fighters to join Islamic State in Syria and Iraq, Spain's Interior Ministry said.

Suspects were detained in the outskirts of Madrid and in other cities and towns in Morocco, it added.

The arrests were linked to "a network ... capturing and sending foreign fighters to join the ranks of the terrorist organization Daesh (Islamic State) in the Syrian-Iraq region that it controls," the ministry statement said.

The operation comes days after a 26-year-old Moroccan man was accused of attacking passengers on a train in France, armed with a Kalashnikov, an assault rifle and a box cutter knife.

Spain and other countries in Europe and North Africa have said they are alarmed about the risk of locals joining militants abroad and returning to launch attacks at home.