The worst terrorist violence France has seen in decades left at least 20 people dead, 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 U.S. no-fly list, according to a U.S. 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 Couliabaly shot a policewoman to death south of Paris.

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 with a lone hostage, 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, explosions, heavy gunfire and dense smoke heralded the the end of the sieges.

The three gunmen were dead — but also killed were four of the 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 one another 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. One of the brothers was wounded in the neck at one point during a shootout with police, Paris Prosecutor Francois Molins said.

In a statement, a member of al-Qaida in the Arabian Peninsula said 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 did not permit him to give his name.

He said the group has delayed its declaration of responsibility for “security reasons.”

The brothers were cornered in the printing plant for much of the day.

“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, declaring “You know who I am,” an official recounted. The attack came a few hours before sundown on the Jewish Sabbath, when the store would have been crowded with shoppers.

Coulibaly killed the four victims in the market shortly after entering, Molins said.

Police released a photo of Coulibaly and his wife, Hayat Boumeddiene, described as an accomplice.

BFM said it spoke with Coulibaly, who told the TV network that he and the Kouachis were coordinating their actions, and that he was with the Islamic State group.

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 U.S. forces in Iraq.

A Yemeni security official said Said Kouachi is suspected of having fought for al-Qaida in Yemen. Another senior security official said Kouachi was in Yemen until 2012.

Both brothers were also on the U.S. no-fly list, a senior U.S. counterterrorism official said, speaking on condition of anonymity because the official was not authorized to discuss foreign intelligence publicly.