French police on Friday shot and killed a suspected hostage-taker at a supermarket in the south of the country.
The suspect killed three people before being shot dead, French interior minister Gerard Collomb said.
In a press conference, French prosecutor François Molins told reporters the gunman shouted "Allahu akbar! (God is great)" and called himself, "a soldier of the Islamic State" when he entered the supermarket, the Associated Press reported.
The Islamic State group has claimed responsibility for the attack.
French authorities confirmed to BuzzFeed News that the gunman, identified by Collomb as Redouane Lakdim, 26, had been killed after elite counterterror police stormed the Super U supermarket in Trèbes, near the historic town of Carcassonne.
Molins said Lakdim had been born in Morocco, and that a woman close to him had been taken into custody, according to the AP.
Lakdim, who lived in Carcassonne, is believed to have acted alone and had convictions for petty crime and drug dealing.
According to French broadcaster BFM TV, he declared allegiance to ISIS and demanded the release of Salah Abdeslam, the most significant surviving suspect in the 2015 Paris terror attacks.
The AP reported that Lakdim was under surveillance and that the government had included him on a list of individuals suspected of being radicalized but who have yet to perform acts of terrorism since 2014.
Still, Molins said there was "no warning sign" that he would carry out an attack.
French president Emmanuel Macron, speaking in Brussels, said he believed the hostage-taking was a terrorist act.
French authorities told BuzzFeed News that a series of incidents had taken place: first when the gunman stole a car near Carcassonne, then when he opened fire on police jogging in the town, and then in the hostage-taking at the supermarket in nearby Trèbes.
One person was killed when the car was hijacked, and two at the supermarket.
Three police officers were wounded in the operation to take down the gunman, including one officer who had been taken hostage.
A Super U employee described fleeing the supermarket while the attacker opened fire.
"I heard gunshots, we brought out as many people as we could," they told French news network BFM TV.
A French law enforcement official, speaking on background from Paris due to a news blackout at the scene, said that counterterror police would have gone into the supermarket only after determining that a “positive outcome” was unlikely, using a euphemism for a peaceful solution.
"The Interior Ministry is technically responsible for making the final decision to send in a unit to kill or capture [the armed suspect] to prevent violence against the hostages," he said.
"Obviously commanders at the scene have the discretion to act to save lives, but in a case like this, the units at the scene...will present a plan to the interior minister and his team. But with the current French government, it is unlikely that they would make a decision without at least consulting Macron," referring to French President Emmanuel Macron.