Spain has "neutralised" the cell behind the Madrid train bombings, according to the outgoing interior minister.
The bomb attacks were funded by drug deals
Angel Acebes said the "nucleus" of the Islamist group was either destroyed by an explosion during a police raid on 3 April, or had been arrested.
He said the cell had financed the plot by selling cannabis and ecstasy.
Eighteen people are facing charges and others are still being questioned over the attacks, which killed 191 people and injured more than 1,900.
The Spanish government has also blamed the cell for planting the explosive device found on the railway line between Madrid and Seville soon after the 11 March train bombings.
On the run
"The nucleus of the Islamist cell responsible for the 11 March attacks and the attempted attack on the Madrid to Seville highspeed rail link has been neutralised," Mr Acebes said on Wednesday.
He said the Madrid cell was divided in to three sub-groups - ideological, logistical and petty criminal.
Some suspects are still on the run, but police believe the masterminds were the ones who blew themselves up during a raid in Madrid's Leganes suburb.
Serhane ben Abdelmajid Fakhet was the alleged ringleader
The leader of the cell, and one of those who died, was Tunisian national Serhane ben Abdelmajid Fakhet, said Mr Acebes.
He described the extremists as "locally-based and autonomous".
But he added that the authorities "cannot rule out the hypothesis that someone with more education concerning Islam and with experience in Afghanistan or elsewhere may have had some influence" in the attacks, the worst in Spain's history.
He said This figure, whom he described as "the emir", may have died in the explosion or may have escaped.
Mr Acebes said the Islamic militants had obtained 200kg (440 pounds) of dynamite from petty criminals in northern Spain, in return for drugs.
Police believe all the explosives have been either used or seized in police raids.
The minister said proceeds from drugs had also funded their apartment, a car and mobile phones.
Investigators were pursuing leads in Britain, Germany, France, Belgium, Tunisia and Morocco, he said.
The father of Bosnian suspect Sanel Sjekirica wanted in connection with the bombings said he was in Sweden but was returning to Spain to hand himself in.
Mr Sjekirica has denied any part in the attacks.