MADRID (Reuters) - Spain has arrested two North Africans suspected of links to the North African branch of the militant Islamist network al Qaeda, the government said on Tuesday, following an investigation lasting more than a year.

One man, an Algerian believed to have trained in a fighter camp in northern Mali run by al Qaeda in the Islamic Maghreb (AQIM), was arrested in the eastern province of Zaragoza, the Interior Ministry said in a statement. The other, a Moroccan also alleged to have had contact with AQIM in Mali, was detained in the southern province of Murcia.

The ministry said the arrests were the result of a joint operation between Spain, France and Morocco but declined to say in response to questions whether the men were believed to be planning an attack or merely providing support for al Qaeda.

A bomb attack on four packed commuter trains at rush hour in central Madrid nearly 10 years ago killed 191 people in Europe's deadliest Islamist militant attack.

Security will be tight at a marathon race being held in Madrid on Sunday in the wake of the Boston Marathon bombing, which killed three people and wounded more than 200 last week. A spokesman for the Interior Ministry declined to say whether there had been any specific threat against Madrid's marathon.

Its statement said the two men had a "similar profile" to the two Chechen brothers believed to have carried out the Boston bombing; Interior Minister Jorge Fernandez later told journalists that this meant they were 'lone wolves' rather than operating in concert with others.

(Reporting by Sonya Dowsett; Editing by Kevin Liffey)