A police sniper shot and killed the gunman who carried out a spate of murders in southern France, prosecutors say, after a 32-hour siege in Toulouse.
Mohammed Merah, 23, who claimed to have al-Qaeda training, opened fire on police commandos after they stormed into his flat at 09:30 GMT.
Prosecutors said he was shot in the head as he tried to flee.
Merah carried out three separate attacks, killing four people at a Jewish school and three soldiers.
He had said he was acting to "avenge Palestinian children" and protest against French military interventions overseas.
A lot of French people will have assumed that if a known radical returns from the Afghan-Pakistani al-Qaeda-ruled badlands, then he will be more or less permanently tailed by the secret service.
But this did not happen. In fact Merah was able to stockpile a huge amount of weaponry, and even when they identified him as a suspect, the DCRI still had no idea of his whereabouts. [Yeah, right]
Interior Minister Claude Gueant's answer to this is that "it is impossible to arrest someone just because he has Salafist views. In France - and this is a good thing - holding a particular point of view is not a crime". [LOL!]
In other words intelligence agents had no particular reason to suspect that Merah's religious extremism would turn to violence.
Did France ignore the threat?
Prosecutor Francois Molins confirmed in a news conference that a police marksman had killed Merah as he tried to jump out of the bathroom window.
"The examination of the body shows that he was shot in the head and that he was wearing a bullet-proof vest," Mr Molins said, "and had a gun covered by a pair of jeans."
"Material to make Molotov cocktails were found on his balcony."
Mr Molins said a Colt 45 handgun was found next to his body, [would this be the same gun he tossed out of the window, perhaps?] and he estimated that Merah had fired 30 bullets as the commandos broke in.
The prosecutor also confirmed that Merah had filmed all three of the attacks that he carried out.
Earlier President Nicolas Sarkozy said in a televised address that everything had been done to try to bring Merah to justice, but it was decided that no more lives could be put at risk.
He also vowed a new crackdown on those who visited "hate or terrorism" web sites or travelled abroad to be indoctrinated in terrorism.
Arms cache
Interior Minister Claude Gueant said officers had thrown grenades and entered by the door and windows of the flat.
After surveying the scene and finding no sign of the suspect, they went towards the bathroom, moving slowly as they were wary of booby-traps.
When officers tried to find out if there was anyone in the bathroom, the suspect came out firing several weapons.
Mr Gueant said the suspect was "shooting very violently. The bursts of gunfire were frequent and hard".
He said one of the officers involved told him "he had never seen such a violent assault".
Two officers were reported wounded in the attack.
Before police went in, officials had warned that Merah was armed with a Kalashnikov high-velocity rifle, a mini-Uzi 9mm machine pistol, several handguns and possibly grenades.
The authorities set off several explosions overnight to intimidate Merah.
Street lights were switched off in the vicinity of the building on Wednesday evening and surrounding areas evacuated.
In his TV address, Mr Sarkozy announced an investigation into whether Merah had accomplices and into possible Islamist indoctrination practices in prisons.
Claude Gueant: "Merah jumped through a window while shooting"
"The French should not give rein to anger," he said.
"Our Muslim compatriots have nothing to do with the crazy actions of a terrorist. We should not embark on any stigmatisation."
Merah, of Algerian descent, claimed to have received al-Qaeda training in Pakistan's Waziristan area, and also said he had been to Afghanistan.
Commentators have criticised the intelligence services for failing to track Merah closely enough.
But Mr Gueant defended their record, saying intelligence agencies track many extremists, but such isolated cases were very difficult to defend against.
"These so-called lone wolves are formidable opponents," he said.
France has seen an unprecedented security clampdown after a lone gunman killed seven people, including three children, in three separate attacks in the south-west of the country.
Police tracked down the main suspect after investigating the movements of a stolen scooter used by the killer to make his escape following shootings in Toulouse and nearby Montauban.
1/7
On 11 March, a soldier was shot and killed while waiting to see a man about selling his motorcycle.
Days later, two soldiers were shot and killed and a third was wounded while waiting at a cash machine.
Then earlier this week, three children and an adult were shot and killed outside a Jewish school.
Mr Molins said the authorities had recovered videos from Merah's apartment showing the attacks.
"These films are extremely explicit, as we were able to verify yesterday, in which evidently we see him during his encounter with a soldier who he shot twice, saying to him: 'You kill my brothers, I kill you'," said Mr Molins.
"Then we also see him killing the soldiers in Montauban in an extremely violent scene, fleeing on his scooter whilst shouting 'Allahu akbar' [God is great]."
Mr Molins said there was also footage of the school massacre, and added that all of Merah's conversations with negotiators during the siege had been recorded and would be used in the forthcoming inquiry.