Spanish police have arrested two men accused of belonging to Islamic State and a third man accused of spreading Islamist militant messages on social media, the Interior Ministry said on Tuesday.

Police detained a Spaniard of Moroccan origin and a Moroccan national said to have been communicating with leaders of the jihadist group and distributing recruitment material on social networks from their homes in Gijon and San Sebastian, it said.

The third man, a 38-year-old Spaniard, was arrested after police linked him to social media postings glorifying Islamist militants and after two house raids turned up a cache of banned weapons. He was detained in the northern city of Manresa and had no direct affiliation to militant networks, the ministry said.

Spain has been on high alert and has stepped up security measures following attacks in Paris last year.

Spanish police have arrested a total of 37 people this year with suspected connections to Islamist militants.