A police officer who swapped himself for a hostage in a supermarket siege is fighting for his life in hospital, French President Emmanuel Macron says.
The gendarme, whom media named as Lt-Col Arnaud Beltrame, helped bring an end to a gunman's shooting spree that killed three in southern France.
The gunman - 25-year-old Redouane Lakdim - said he had been acting on behalf of the Islamic State group.
He was shot dead by French police after mounting three separate attacks.
Sixteen people were injured, two seriously, in what Mr Macron called an act of "Islamist terrorism".
Lakdim is said to have been demanding the release of Salah Abdeslam, the most important surviving suspect in the 13 November 2015 attacks in Paris, which killed 130 people.
One person - believed to be Lakdim's partner - has been arrested in connection with the shootings.
How did events unfold?
The violence began on Friday morning in Carcassonne, where Lakdim hijacked a car, killing one passenger - whose body was later found hidden in a bush - and injuring the driver.
He then shot and wounded a policeman who was jogging with colleagues.
Lakdim is then believed to have driven a few kilometres to the small town of Trèbes, where he charged into the Super-U supermarket, shouting, "I am a soldier of Daesh [Islamic State]!"
He killed two people - a customer and store employee - before seizing others as hostages.
Carole, who was shopping at the supermarket, said people hid in a cold room.
"A man shouted and fired several times," she told France info radio. "I saw a cold room door, I asked people to come and take shelter."
"There were 10 of us, and we stayed an hour. There were more gunshots and we went out the emergency back door."
Interior Minister Gérard Collomb told reporters that police officers had managed to get some people out but the gunman had held one woman back as a human shield.
It was at this point, he said, that the 45-year-old gendarme officer had volunteered to swap himself for her, leaving his mobile phone on a table with an open line so police could monitor the situation.
When police heard gunshots, a tactical team stormed the supermarket. The gunman was killed but Arnaud Beltrame was seriously injured.
Mr Collomb hailed the "heroism and courage" of Lt-Col Beltrame.
President Macron said he had "saved lives and honoured his colleagues and his country".
A Portuguese national said to have been killed was in fact seriously injured, a government official in Lisbon said later, according to AFP news agency.
What do we know about the suspect?
Redouane Lakdim, who was born in April 1992 in Morocco and had French nationality, was known to French intelligence services.
Prosecutor Francois Molins said he had been on an extremist watch-list due to "his radicalisation and his links with the Salafist movement", a hardline offshoot of Sunni Islam. But subsequent investigations by intelligence services had not turned up any signs he would act, he said.
Lakdim was found guilty of carrying a prohibited weapon in 2011 and convicted for drug use and refusing a court order in 2015, Mr Molins said.
Earlier, Mr Collomb said that though he had been known to authorities as a petty criminal. they "did not think he had been radicalised".
Lakdim lived in an apartment in Carcassonne with his parents and several sisters. A neighbour saw him taking one of his sisters to school on Friday morning.
The family's apartment was raided by police on Friday afternoon.
What has the reaction been?
In a statement released online, Islamic State militants claimed the attacker was "a soldier of the Islamic State" - a claim President Macron said the security services were studying.
France has been hit by several deadly jihadist attacks since 2015 and has been on high alert since, though a state of emergency was lifted last year.
In February, Salah Abdeslam went on trial in Belgium over a shootout in Brussels that led to his capture months after the Paris attacks. He is not expected to go on trial in France until 2020 at the earliest.
Major terror attacks in France
- 1 Oct 2017 - Two women stabbed to death at Marseille railway station; attack claimed by IS
- 26 Jul 2016 - Two attackers slit priest's throat at his church in Normandy; shot dead by police
- 14 Jul 2016 - Huge lorry mows down crowd on Nice beachfront, killing 86. IS claims attack by Tunisian-born driver, later shot dead by police
- 13 Jun 2016 - Police officer and his partner stabbed to death at home in Magnanville, west of Paris, by a jihadist declaring allegiance to IS - police later kill him
- 13 Nov 2015 - IS jihadists attack Paris, targeting the national stadium, cafes and Bataclan concert hall, leaving 130 dead
- 7-9 Jan 2015 - Two Islamist gunmen storm the offices of satirical magazine Charlie Hebdo, killing 17 people. Another Islamist militant kills a policewoman the next day and takes hostages at a Jewish supermarket in Paris. Four hostages are killed before police shoot the gunman dead
Are you in the area? Have you witnessed what has happened? If it is safe to share your experience please email email@example.com.
Please include a contact number if you are willing to speak to a BBC journalist. You can also contact us in the following ways: