THE gendarmerie officer who volunteered himself as a hostage in exchange for civilians during a terror attacks in southern France is “fighting against death”, French President Emmanuel Macron says.

Three people died and 16 were injured when a lone gunman stormed a Super U supermarket in the town of Trebes, near the city of Carcasonne at about 11am on Friday local time (9pm AEDT).

The senior police officer swapped places with a hostage being held by gunman Redouane Lakdim, 26, allowing the hostage to escape safely, Interior Minister Gerard Collomb said.

“He saved lives and did honour to his corps and his country,” Macron said after a meeting with Prime Minister Edouard Philippe and security officials.

“Now he is fighting against death and all our thoughts are with him and his family.”

The officer who offered to be swapped for a female hostage was identified as Col. Arnaud Beltrame.

The lieutenant-colonel left his mobile on a call on a table, allowing security forces to hear what was taking place inside the supermarket, Collomb said after the incident ended on Friday.

When they heard shots being fired, special forces intervened and “took down” the gunman.

Collomb hailed the officer’s “act of heroism”.

Macron confirmed that three people had died and 16 were injured in the series of attacks. A claim of responsibility by the Islamic State extremist group was “currently being analysed”, he said.

“I invite all our fellow-citizens to be conscious of the gravity of the terrorist threat, but also of the strength and resistance that our people has displayed every time it has been attacked,” he concluded.

The gunman, named by Interior Minister Gerard Collomb as 26-year-old Redouane Lakdim, reportedly started his rampage by hijacking a car and shooting its passenger in the head.

Yves Lefebvre, secretary general of the SGP Police-FO union, said the suspect then fired six shots at police officers who were on their way back from jogging near the city of Carcassonne.

One police officer was injured in the shoulder but is not in life-threatening condition, Mr Lefebvre said.

Mr Collomb said Lakdim was a small-time drug dealer.

“He was known by the police for petty crimes, we had monitored him and did not think he had been radicalised,” Mr Collomb said after arriving at the scene of the hostage-taking in the town of Trebes, near Carcassonne. “He was already under surveillance when he suddenly decided to act.”

Security sources had said the gunman was believed to be a Moroccan who was on a watch list of suspected Islamic extremists, but Collomb did not confirm his nationality.

BFM reported that he demanded the release of Salah Abdeslam, one of the alleged masterminds of the Paris terror attacks in 2015 which killed 130 people.

Lakdim reportedly killed a butcher and a shopper while terrified customers either fled from the store or hid in a cool room.

Macron confirmed authorities believed the incident was a terror attack. “Everything leads us to believe it is a terror attack,” he said.

French Prime Minister Edouard Philippe also said all information suggests that the shooting inside the supermarket and the earlier shooting of a police officer “seems to be a terrorist act”.

“All the information we have as I speak lead us to think that this would be a terrorist act,” Mr Philippe said.

The Islamic State jihadist group claimed responsibility for the attack but are often quick to claim attacks which aren’t carried out by their members.

“The person who carried out the attack in Trebes in southern France is a soldier of the Islamic State and he carried out the operation in response to a call to target states” of the anti-IS international coalition, the Amaq agency said in a statement on social messenging app Telegram.

Trebes Mayor Eric Ménassi had earlier told another TV network, LCI, that the man had been screaming “Allahu Akbar, (God is greatest) I’ll kill you all”.

AFP reported a French security source had told them most employees and customers at the supermarket had managed to flee to safety.

France has suffered several serious terror attacks in the past three years and the state of emergency declared after the November 205 attacks on cafes and the Bataclan theatre in Paris was only lifted in November.