PARIS — With explosions and gunfire, security forces Friday ended three days of terror around Paris, killing the two al-Qaida-linked brothers who staged a murderous rampage at a satirical newspaper and an accomplice who seized hostages at a kosher supermarket to try to help the brothers escape.
The worst terrorist violence France has seen in decades killed at least 20 people, including the three gunmen. A fourth suspect — the common law wife of the market attacker — was still at large and believed to be armed.
Al-Qaida’s branch in Yemen said it directed the attack against the publication Charlie Hebdo to avenge the honor of the Prophet Muhammad, a frequent target of the weekly’s satire.
The brothers were not unknown to authorities: One had a terrorism-related conviction for ties to a network sending fighters to battle American forces in Iraq, and both were on the US no-fly list, according to a US official.
President Francois Hollande urged his nation to remain united and vigilant, and the city shut down a famed Jewish neighborhood amid fears of more violence.
‘‘The threats facing France are not finished,’’ Hollande said. ‘‘We are a free people who cave to no pressure.’’
The drama, which played out on live TV and social media, began with the brothers Said and Cherif Kouachi methodically massacring 12 people Wednesday at the Charlie Hebdo offices, stopping to shoot a wounded police officer in the head before escaping by car.
On Thursday, a gunman police identified as Amedy Coulibaly shot a policewoman to death south of Paris, although authorities were not sure at first if it was related to the Charlie Hebdo shootings.
It all ended at dusk Friday with near-simultaneous raids in two locations: a printing plant in the town of Dammartin-en-Goele, northeast of Paris, where the Kouachis were holed up, and the Paris supermarket where Coulibaly killed four hostages and threatened more violence unless the police let the Kouachis go.
As scores of black-clad security forces surrounded both sites, booming explosions, heavy gunfire and dense smoke heralded the news that the twin sieges finally had ended.
The three gunmen were dead — but the authorities also discovered four dead hostages at the market. Sixteen hostages were freed, one from the printing plant and 15 others from the store.
The attackers had ties both to each other and to terrorist activities that reached back years and extended from Paris to al-Qaida in Yemen. They epitomized Western authorities’ greatest fear: Islamic radicals who trained abroad and came home to stage attacks.
After the killings at the Charlie Hebdo offices, Cherif Kouachi, 32, and his 34-year-old brother Said led police on a chase around northeastern France, robbing a gas station and stealing a car before ending up at the printing plant in Dammartin-en-Goele, near Charles de Gaulle airport. One of the brothers was wounded in the neck at one point during a shootout with police after he commandeered a car, Paris Prosecutor Francois Molins said.
Authorities said the brothers temporarily took a man hostage at the plant but let him go, and a second man was later discovered to have been hiding inside the building.
A member of the al-Qaida in the Arabian Peninsula gave a statement in English to The Associated Press saying the group’s leadership ‘‘directed the operations and they have chosen their target carefully.’’
The attack was in line with warnings from the late al-Qaida leader Osama bin Laden to the West about ‘‘the consequences of the persistence in the blasphemy against Muslim sanctities,’’ the member said, speaking on condition of anonymity because the group’s regulations do not permit him to give his name.
He said the group has delayed its declaration of responsibility for ‘‘security reasons.’’
The brothers were cornered there for much of the day before the explosions and gunfire rang out in the twilight and a police SWAT team clambered onto the roof.
‘‘They said they want to die as martyrs,’’ Yves Albarello, a local lawmaker inside the command post, told French television station i-Tele.
At the kosher grocery near the Porte de Vincennes neighborhood in Paris, the gunman burst in shooting just a few hours before the Jewish Sabbath began, declaring ‘‘You know who I am,’’ the official recounted. The attack came before sundown when the store would have been crowded with shoppers.
Coulibaly killed the four people in the market shortly after entering, Molins said.
Several people wounded when Coulibaly opened fire in the grocery store were able to flee and get medical care, the official said.
About 100 students were locked down in nearby schools and the highway ringing Paris was closed.
The mayor’s office also shut down all shops along Rosiers Street in the city’s famed Marais neighborhood in the heart of the tourist district. Hours before the Jewish Sabbath, the street is usually crowded with shoppers. The street is also only a kilometer (half-mile) from Charlie Hebdo’s offices.
Charles de Gaulle airport, not far from the standoff in Dammartin-en-Goele, briefly closed two runways to arrivals, and Hollande held a series of crisis meetings with his security team throughout the day.
Police released a photo of Coulibaly and his wife, Hayat Boumeddiene, described as an accomplice.
Authorities increasingly grew to see links between the attackers after they discovered that Boumeddiene and the companion of one of the Kouachi brothers had exchanged about 500 phone calls, Molins said.
Boumeddiene remains at large and is believed to be armed.
Molins added that several people have been given preliminary charges in the investigation. They include relatives of the three gunmen.
Several people who were wounded when the gunman opened fire in the grocery store fled and got medical care, the official said.
Minutes before police stormed both sites, Coulibaly had threatened more violence if authorities launched an assault on the two brothers, a police official said. A group of people holed up in the supermarket’s freezer — apparently unbeknownst to the gunman.
BFM also said it spoke with Coulibaly, who said he and the Kouachis were coordinating their actions, and that he was with the militant Islamic State group. The organizations are normally rivals.
The TV station said Coulibaly didn’t hang up properly after the phone call and that this allowed police to hear him saying a final prayer before his death, perhaps suggesting that this prompted the police raid.
In the final assault, phalanxes of security forces converged on the store entrance behind a flash from a stun grenade — and fired inside. Frenzied civilians — one of them carrying a toddler — scurried out under escort by helmeted police in body armor.
Police said Coulibaly had been a co-suspect with Cherif Kouachi in a court case involving terrorism that never made it to trial.
Cherif Kouachi was convicted of terrorism charges in 2008 for ties to a network sending jihadis to fight US forces in Iraq.
According to a Yemeni security official, Said Kouachi is suspected of having fought for al-Qaida in Yemen. Another senior security official added that Said was in Yemen until 2012.
Both officials spoke to the AP on condition of anonymity because of an ongoing investigation into Kouachi’s stay in Yemen.
Both brothers were also on the US no-fly list, a senior US counterterrorism official said, speaking on condition of anonymity because the official was not authorized to discuss foreign intelligence publicly.
The attacks in France as well as a hostage siege last month in Sydney and the October killing of a solder near Canada’s parliament prompted the US State Department to issue a global travel warning for Americans. It also cites an increased risk of reprisals against US and Western targets for the US-led intervention against Islamic State militants in Syria and Iraq.
Authorities around Europe have warned of the threat posed by the return of Western jihadis trained in warfare. France counts at least 1,200 citizens in the war zone in Syria — headed there, returned or dead. Both the Islamic State group and al-Qaida have threatened France, home to Western Europe’s largest Muslim population.
The publication Charlie Hebdo had long drawn threats for its depictions of Islam, although it also lampooned other religions and political figures. It had caricatured the Prophet Muhammad, and a sketch of Islamic State’s leader was the last tweet sent by the irreverent newspaper minutes before the attack.
Eight journalists, two police officers, a maintenance worker and a visitor were killed in the newspaper attack, including the paper’s editor. Charlie Hebdo plans a special edition next week, produced in the offices of another paper.
More on the France terror attacks:
Associated Press writers Samuel Petrequin, Sylvie Corbet, Jamey Keaten, John Leicester and Angela Charlton in Paris; Raphael Satter and Trung Latieule in Dammartin-en-Goele, Jill Lawless in London; Eric Tucker in Washington; Ahmed al-Hag in Sanaa, Yemen; Sarah el-Deeb in Cairo contributed to this report.