A gunman who was allegedly affiliated with the Islamic State and who stormed a supermarket in France Friday morning, killing three and injuring 16 others, has been shot and killed, officials said.

Minister of the Interior of France, Gérard Collomb tweeted that the gunman, 24-year-old Redouane Lakdim, had been shot and killed by police gun fire.

French President Emmanuel Macron said investigators will be looking into how and when Lakdim was radicalized and where he obtained the gun.

Officials say the gunman claimed his first victim while hijacking a car before targeting the supermarket. Lakdim is known by local police services as a small time drug dealer.

Initial reports indicate the shooter killed a butcher at Super U Trebes in Aude before opening fire on a group of police officers returning from a jog, then barricaded himself inside the supermarket.

Express News reported that witnesses said the gunman pledged allegiance to ISIS. Some say the shooter yelled “Allah Akbar.”

All information suggested it “seems to be a terrorist act," Prime Minister Edouard Philippe said.

“Police Intervention underway at #Trèbes in the #Aude. The priority is to the intervention of the police and relief forces. More information to come on this account, do not broadcast rumors,” the Interior Ministry of France posted on Twitter .

In another tweet , the Ministry said a perimeter had been secured around the supermarket, and warned people to stay away from the immediate area where the store is located.

A police officer offered himself up in a hostage exchange and was seriously injured as a result.

"He saved lives" and is now in life-threatening condition, Macron said of the officer while speaking at the emergency center at the interior ministry following a meeting there.