PARIS—France’s capital was transformed into a war zone as a three-day manhunt for militants who attacked the magazine Charlie Hebdo ended Friday when security forces in simultaneous raids killed three men suspected in the slaying of 17 people, including four hostages at a kosher grocery.

The carnage played out in a multifront battle that frayed the nerves of a nation already on edge over the state of its security and social cohesion.

By the time the smoke cleared, police had killed Said Kouachi, 34 years old, and his brother Chérif Kouachi, 32—the two gunmen suspected of Wednesday’s attack on the French magazine. Authorities had cornered the French-born brothers at a printing facility near the capital’s main airport.

(Latest:Charlie Hebdo puts Muhammad on cover of post-attack issue).

On the city’s eastern edge, meanwhile, police stormed a kosher grocery where an alleged confederate of the two brothers held several people hostage at gunpoint. The man, Amedy Coulibaly, 32 years old, was killed. Officials said they believed he killed four hostages before police raided the store.