Spanish police arrested a 32-year-old Moroccan in a dawn raid in central Madrid who they said was "highly radicalised" and had a large collection of extreme Islamist material including a manual for suicide bombers.
Police also arrested two other Moroccan men aged 38 and 33 who lived with the first man in the residential apartment, the interior ministry said in a statement.
Television images showed armed police in riot gear storming the apartment building before dawn and men dressed in white robes and motorcycle helmets being grappled to the ground and handcuffed outside the apartment block.
The man had an extremely dangerous profile, similar to that of those who carried out recent attacks in Britain and France, the government said, without giving further details.