Two brothers wanted for a bloody attack on the offices of French satirical newspaper Charlie Hebdo were killed on Friday when anti-terrorist police stormed their hideout, while a second siege ended with the deaths of four hostages.
The violent end to the simultaneous stand-offs northeast of Paris and at a Jewish supermarket in the capital followed a police operation of unprecedented scale as France tackled one of the worst threats to its internal security in decades.
With one of the gunmen saying shortly before his death that he was funded by al Qaeda, President Francois Hollande warned that the danger to France - home to the European Union's biggest communities of both Muslims and Jews - was not over yet.
"These madmen, fanatics, have nothing to do with the Muslim religion," Hollande said in a televised address. "France has not seen the end of the threats it faces."
An audio recording posted on YouTube attributed to a leader of the Yemeni branch of al Qaeda (AQAP) said the attack in France was prompted by insults to prophets but stopped short of claiming responsibility for the assault on the offices of Charlie Hebdo.
Sheikh Hareth al-Nadhari said in the recording, "Some in France have misbehaved with the prophets of God and a group of God's faithful soldiers taught them how to behave and the limits of freedom of speech."
"Soldiers who love God and his prophet and who are in love with martyrdom for the sake of God had come to you," he said in the recording, the authenticity of which could not immediately be verified.
A Yemeni journalist who specialises in al Qaeda said it was clear that AQAP had provided a "spiritual inspiration" for the attack on the newspaper offices, but there was no clear sign that it was directly responsible for the assault.
Following heavy loss of life over three consecutive days, which began with the attack on Charlie Hebdo when 12 people were shot dead, French authorities are trying to prevent a rise in vengeful anti-immigrant sentiment.
Hollande denounced the killing of the four hostages at the kosher supermarket in the Vincennes district of Paris. "This was an appalling anti-Semitic act that was committed," he said.
Officials said Cherif Kouachi and his brother Said, both in their thirties, died when security forces raided a print shop in the small town of Dammartin-en-Goele, northeast of Paris, where the chief suspects in Wednesday's attack had been holed up. The hostage they had taken was safe, an official said.
Automatic gunfire rang out, followed by blasts and then silence as smoke billowed from the roof of the print shop. In thick fog, a helicopter landed on the building's roof, signalling the end of the assault. A government source said the brothers had emerged from the building and opened fire on police before they were killed.
Before his death, one of the Kouachi brothers told a television station he had received financing from an al Qaeda preacher in Yemen.
"I was sent, me, Cherif Kouachi, by Al Qaeda of Yemen. I went over there and it was Anwar al Awlaki who financed me," he told BFM-TV by telephone, according to a recording aired by the channel after the siege was over.
Al Awlaki, an influential international recruiter for al Qaeda, was killed in September 2011 in a drone strike. A senior Yemeni intelligence source earlier told Reuters that Kouachi's brother Said had also met al Awlaki during a stay in Yemen in 2011.
Minutes after the print shop assault, police broke the second siege at the supermarket in eastern Paris. Four hostages died there along with the gunman, Amedy Coulibaly.
Coulibaly had also called BFM-TV to claim allegiance to Islamic State, saying he wanted to defend Palestinians and target Jews.
Coulibaly said he had jointly planned the attacks with the Kouachi brothers, and police confirmed they were all members of the same Islamist cell in northern Paris.
Police had already been hunting 32-year-old Coulibaly along with a 26 year-old woman after the killing on Thursday of a policewoman. The woman, Hayat Boumeddiene, remains on the run.
Paris chief prosecutor Francois Molins told a press briefing that the two Kouachi brothers and Coulibaly had an arsenal of weapons and had set up booby traps. He said they had a loaded M82 rocket launcher, two Kalashnikov machine guns and two automatic pistols on them.
"On the body of one of the terrorists, the demining teams also found a grenade that had been positioned as a trap," Molins said.
He said Coulibaly had attacked police forces with a Kalashnikov assault rifle and a "Skorpion" military pistol. After he was shot, police found two Russian-made Tokarev pistols, two machine guns, a bullet-proof vest and ammunition in the kosher supermarket.
"The supermarket had also been booby-trapped," he said, noting that Coulibaly had placed 15 explosive sticks and one detonator in the supermarket.
Altogether 17 victims have died along with the three hostage-takers since Wednesday.
France plans a unity rally on Sunday to protest against the attacks. Among those due to attend are German Chancellor Angela Merkel, Prime Ministers David Cameron of Britain,Matteo Renzi of Italy and Mariano Rajoy of Spain, and European Commission president Jean-Claude Juncker.
President Barack Obama also expressed U.S. support. "I want the people of France to know that the United States stands with you today, stands with you tomorrow," he said.
World Jewish Congress President Ronald Lauder joined the condemnations, saying, "Jewish life in France under threat if terror does not stop".
Hostages rushed out
News footage of the kosher supermarket showed dozens of heavily armed police officers outside two entrances. The assault began with gunfire and an explosion at the door, after which hostages were rushed out.
Reuters photographs taken from long distance showed a man holding an infant being herded into an ambulance by police. Others were carried out on stretchers.
French authorities mobilised a force of nearly 90,000 after Wednesday's attack on Charlie Hebdo, a weekly that has long courted controversy by mocking Islam and other religions and political leaders.
A witness said one of the gunmen in Wednesday's attack was heard to shout: "We have killed Charlie Hebdo! We have avenged the Prophet!"
The Kouachi brothers are believed to be the hooded gunmen who shot dead some ofFrance's top satirical cartoonists along with two police officers.
Security sources said the brothers, who were born in France of Algerian-born parents, had been under surveillance and had been placed on European and U.S. "no-fly" lists.
The violence raised questions about surveillance of radicals, far-right politics, religion and censorship in a land struggling to integrate part of its five million-strong Muslim community.