Lieutenant-Colonel Arnaud Beltrame, 45, took the place of a woman who gunman Radouane Lakdim was holding as a final hostage in the Super U store in the quiet southwest town of Trebes on Friday.
A senior officer in the gendarmerie, a police force which is part of the French military, Beltrame hoped to be able to negotiate with Lakdim once the 50 shoppers and staff caught up in the siege had been taken to safety.
He left his telephone on a table to allow authorities to hear what was happening inside.
But Lakdim, who claimed allegiance to the Islamic State group, shot and stabbed him, prompting a police raid that left the attacker dead. Beltrame succumbed to his wounds early Saturday.
President Emmanuel Macron led a flood of tributes to Beltrame, who had served for four years protecting the presidential palace in the 2000s.
“Lieutenant-Colonel Beltrame displayed exceptional calm in the heat of the moment and showed the virtue of our security forces in astonishing fashion,” Macron said.
The officer, who was married with no children, “died a hero”, the president said.
Beltrame's brother Cedric said he would have known all too well the risk he was taking.
“He certainly knew he didn't stand a chance,” he said.
“He gave his life for another.”
And Beltrame's mother, who has not been named, she was unsurprised her son would put others' lives before his own.
“He was always like that — he's someone who ever since he was born did everything for his country,” she told RTL radio.
“He would tell me, 'Mum, I do my job. That's all.'”
By poignant coincidence, Beltrame had simulated a terrorist attack at a supermarket in December as a training exercise, in his role as deputy chief of the gendarmerie in the local Aude region.
He graduated in 1999 from France's top military college, Saint-Cyr, where his superiors described him as someone who “fought until the end and never gave up”, Macron said.
He was one of just a handful of candidates chosen to join the gendarmerie's elite GSIGN force in 2003 and was deployed to Iraq in 2005, where he won a Cross for Military Valour.
He joined the Republican Guard protecting the presidential palace after returning from Iraq, and also worked as an advisor to the environment ministry.
He had been named just last year as deputy chief of the gendarmerie in the Aude, where Lakdim unleashed his shooting spree in the medieval town of Carcassonne before driving to the supermarket in nearby Trebes.
“His leadership abilities and his dedication were appreciated by everyone, notably in developing the anti-terror capacity of the gendarmerie in the Aude,” Macron said.
Flags flew at half-mast at gendarmerie bases across France on Saturday.
Anne-Marie Bonnet was among a flock of local residents coming to lay flowers at Beltrame's base in Carcassonne, where a white rose hung at the door.
“We want to thank him for what she did,” she said. “It was a heroic gesture and I'd rather we talk about him than the other one,” she said of the attacker.
Beltrame is the seventh member of France's security forces to be killed in a jihadist attack since 2012.
France is a member of the US-led coalition that has fought the Islamic State group in Syria and Iraq, and soldiers and police have often found themselves the target in domestic attacks.