An attack on a supermarket in the south of France that left three dead and 16 injured was an “act of Islamist terror”, French President Emmanuel Macron has said.

A gunman opened fire on a group of police officers, injuring one, before taking hostages in a branch of Super U. The incident ended with armed police raiding the supermarket, shooting the assailant dead.

French authorities identified the suspect as Redouane Lakdim, 26, a petty criminal and small-time drug dealer who he said was radicalised and under police surveillance.

Witnesses said the man had entered the shop screaming “Allahu Akbar, I’ll kill you all”, before declaring allegiance to Isis and demanding the release of Paris attacks suspect Salah Abdeslam.

Police are seen at the scene of a hostage situation in a supermarket in Trèbes, Aude, France (Reuters)

Isis later claimed the attacker was a “soldier of the Islamic State”, without providing evidence of its involvement. Mr Macron said an investigation would establish whether the attack was directed or simply inspired by the terror group.

“I want to tell the nation tonight of my absolute determination in leading this fight,” Mr Macron said in an address, flanked by French Prime Minister Édouard Philippe.

“I urge our fellow French citizens to remain aware of the terrorist threat, but to also be aware of the force and resistance our people demonstrated each and every time it was attacked.”

Moroccan-born Lakdim had been under surveillance by security services in 2016-2017 for links to the radical Salafist movement, said Paris prosecutor Francois Molins, who is leading the investigation.

"The monitoring ... did not reveal any apparent signs that could lead (us) to foresee he would act," Mr Molins said.

He added that one woman connected to Lakdim had been arrested, however Interior Minister Gerard Collomb said he believed Lakdim had acted alone.

The gunman was reported to have taken up to eight hostages near Toulouse on Friday morning, and was killed by officers who stormed the supermarket in Trèbes after 2pm local time.

Lakdim first killed one person with a bullet in the head while stealing a car in Carcassonne.

He pulled up in the car to four police officers who were jogging in the city and opened fire, hitting one in the shoulder, then sped off to Trebes, about 5 miles to the east, where he took the hostages in the supermarket.

Mr Collomb praised the “heroism” of a French police officer who offered himself up as a hostage swap during the attack and was subsequently seriously injured. He remained in a critical condition on Friday evening.

He said the officer “volunteered to swap his place with a hostage” inside the Super U shop and stayed with the armed suspect. He managed to leave his mobile phone switched on after the swap, establishing contact with officers outside the supermarket during the hours-long siege.

Mr Collomb said elite French forces stormed the market and killed the gunman after hearing shots from inside. He did not say how or when the police officer was injured.

Trebes siege: France supermarket shooting Show all 14 1 /14 Trebes siege: France supermarket shooting Trebes siege: France supermarket shooting Rescue forces and police officers at a supermarket after a hostage situation in Trebes, Reuters Trebes siege: France supermarket shooting Forensic police investigate after the gendarme's assault on the Super U supermarket. EPA Trebes siege: France supermarket shooting Police are seen at the scene of a hostage situation in a supermarket in Trebes. Reuters Trebes siege: France supermarket shooting A view of the Super U supermarket where a gunman reportedly claimed allegiance to the Islamic State and is holding hostages. EPA Trebes siege: France supermarket shooting Emmanuel Macron is informed by his security advisor about the hostage situation in Trebes during the joint press conference with Angela Merkel at the summit of European Union leaders. AFP/Getty Trebes siege: France supermarket shooting A gendarmerie helicopter flies over the Super U supermarket. EPA Trebes siege: France supermarket shooting French gendarmes and police establish a security perimeter around the Super U supermarket. EPA Trebes siege: France supermarket shooting Police officers secure evidence. EPA Trebes siege: France supermarket shooting French gendarmes block the access to Trebes. AFP/Getty Images Trebes siege: France supermarket shooting Police attend the incident in Trebes. La Depeche Du Midi via AP Trebes siege: France supermarket shooting French police and firefighters secure the entrance of Trebes. AP Trebes siege: France supermarket shooting A genera; view of The Super U shop in Trèbes, southern France, where hostages were reportedly taken by a gunman claiming allegiance to Isis. Google Street View Trebes siege: France supermarket shooting Police block a road near the scene. Reuters Trebes siege: France supermarket shooting French gendarmes block the access to Trebes. AFP/Getty

France has been on high alert since a string of Islamic extremist attacks in 2015 and 2016 that killed more than 200 people.

Friday’s shootings took place in a normally quiet part of the country, where the main tourist attraction is the treasured old city of Carcassonne, its medieval walls and its summertime festivals.