The suspected ringleader of the Madrid bombings blew himself up along with four other suspects during a police raid, Spain's interior minister said.
Serhane ben Abdelmajid Fakhet was said to be the cell leader
Angel Acebes said Serhane ben Abdelmajid Fakhet, alias "The Tunisian", died in an explosion in a Madrid suburb on Saturday night.
One policeman died in the blast and 11 others were hurt, some seriously.
Outside the flats where the explosion took place, police found - and safely defused - a car packed with explosives.
Officers searching the building say they have found two backpacks full of explosives, in addition to dynamite and detonators found there on Saturday.
Serhane ben Abdelmajid Fakhet was named last week in international arrest warrants connected with the attacks.
Another of the dead suspects, Moroccan Abdennabi Kounjaa, was also among six suspects named in the arrest warrants, said Mr Acebes, who is part of the outgoing Spanish government.
A third man - Asri Rifaat Anouar - was not on the list, the minister said.
A fourth suspect, who has not been identified, was wearing a belt of explosives, Mr Acebes said.
The presence of a fifth suspect at the scene of the explosion was confirmed late on Sunday after investigators had spent a full day removing body parts from the site of the blast.
Spain has already detained 15 suspects over the Madrid attacks, in which 191 people were killed.
"The core of the group that carried out the attacks is either arrested or dead in yesterday's collective suicide, including the head of the operative commando," Mr Acebes told a news conference.
Police found 200 detonators of the kind used in the Madrid attacks and in the unexploded bomb that was discovered on the high speed Madrid-Seville rail line on Friday, Mr Acebes said.
Police also removed 10kg (22 pounds) of dynamite from the apartment.
"They were going to keep on attacking because some of the explosives were prepared, packed and connected to detonators," Mr Acebes said.
A further two or three people may have escaped before the blast, the minister said.
Chanted in Arabic
The suspects spotted the police as they prepared to enter the apartment in the suburb of Leganes and opened fire from the first floor window, while chanting in Arabic, officials and local residents said.
Mr Acebes said the blast was set off by the suspects as police prepared to enter the apartment on Irene Fernandez street.
Police evacuated residents in the building and the surrounding area, and cordoned it off.
The blast sent a shower of shattered glass into the air and thick grey smoke billowed over the area.
The explosion destroyed the front of the building
Frightened residents crowded onto the nearby streets.
Neighbours said a group of North Africans had moved into the apartment about a month ago. They were rarely seen and the blinds were always drawn, the neighbours said.
Several families were put up in a hotel overnight because they could not return to their damaged homes.
The 11 March attacks on four commuter trains in Madrid was Europe's worst terror attack since the 1988 Lockerbie bombing.
Spain has provisionally charged 15 suspects in connection with the blasts.
Six of them have been charged with multiple counts of murder, and nine have been accused of collaborating with or belonging to a terrorist organisation.
Eleven of the detained 15 suspects are Moroccan.
The Moroccan Islamic Combatant Group is the main focus of police investigations.