Swapping places with a woman being held hostage, the French police officer entered the supermarket where a gunman, claiming allegiance to the Islamic State, had already shot and killed two people on Friday.
While he did not carry a gun as he went inside, Lt. Col. Arnaud Beltrame did bring in his phone, which he left on a table with the line open so that his colleagues outside could listen in, according to Gérard Collomb, France’s interior minister.
The officer spent about two hours inside the Super U market facing the gunman, Radouane Lakdim, a 25-year-old French citizen born in Morocco, officials said.
After officers heard more gunshots through the phone, they rushed into the market and killed Mr. Lakdim. Colonel Beltrame, 44, who had been “seriously wounded” by gunfire, Mr. Collomb said, died overnight of his injuries.
Colonel Beltrame’s mother said that she knew it was her son inside the supermarket as soon as she heard that a lieutenant colonel had exchanged himself to free a hostage.
“I am not surprised that it was him,” she said in an interview with the French radio network RTL. “He has always been like this.” His mother, who was not named, described the officer as someone whose reason for being was to defend others’ lives. “He would tell me, ‘I am doing my job, Mom, that’s all,’” she added.
The officer’s brother, Cédric Beltrame, told RTL that he thought his brother had known he had little chance to survive when he decided to go inside the market. “He was very aware of what he was doing; he didn’t hesitate for a second,” Mr. Beltrame said.
France on Saturday mourned Colonel Beltrame’s death, with President Emmanuel Macron praising his courage and announcing that a national tribute would be organized in his memory.
Mr. Macron expressed condolences to the officer’s widow and relatives on Twitter on Saturday. And the office of the presidency said that Colonel Beltrame had “displayed exceptional sang-froid and illustrated military virtues in a brilliant way, which deserves the respect and the admiration of the whole nation.”
“France will never forget his heroism, his bravery, his sacrifice,” Mr. Collomb said on Twitter.
The terrorist attack in Trèbes, a town about 60 miles southeast of Toulouse, began with a deadly car hijacking.
Mr. Lakdim shot and wounded the driver of the car and killed a passenger, Jean Mazières, a retired winemaker, according to local news media. The gunman then shot at a group of police officers who were returning from a jog, wounding one.
After he left the hijacked car in the supermarket’s parking lot, Mr. Lakdim stormed into the store around 11:15 a.m., according to the national gendarmerie. About 50 people were shopping for groceries, and the gunman killed two people on the spot, the authorities said.
Some shoppers escaped through emergency exits at the back of the market, while others hid. Christian Guibbert, a retired police officer who was shopping with his wife and sister-in-law, told French news outlets that he heard gunshots and saw a “very agitated” man yell “God is great” in Arabic.
Mr. Guibbert said he locked his relatives and other shoppers in a meat locker and called the police.
Then, Colonel Beltrame offered to exchange himself for a female hostage. It was unclear on Saturday if Mr. Lakdim had been holding more than one person hostage.
After about two hours, and for reasons still unknown on Saturday, the French authorities said Mr. Lakdim shot at Colonel Beltrame several times before the police stormed the market and killed Mr. Lakdim. It remained unclear whether Colonel Beltram was also wounded in the resulting exchange of gunfire between the police and the assailant.
The Paris prosecutor’s office said Saturday that three homemade explosive devices, a handgun and a hunting knife were found inside the store. The authorities also searched Mr. Lakdim’s home on Saturday and found notes referring to the Islamic State.
The death of Colonel Beltrame brought the death toll from Friday’s violent outburst in southern France to five, including the gunman; 15 others were wounded. Among the victims identified on Saturday were a butcher at the supermarket, Christian Medves, 50, according to local news outlets, and Hervé Sosna, 65, who lived in Trèbes.
The Islamic State claimed responsibility for the attack. It was the latest in a string of smaller-scale, individual terrorist acts to rattle a country on a high terrorist alert since attacks in Paris and Nice in 2015 and 2016.
A double valedictorian who graduated at the top of his class from the prestigious military school Saint-Cyr in 1999 and from the gendarmerie school in 2001, Arnaud Beltrame joined the special forces unit of the gendarmerie, known as the G.I.G.N., in 2003. He was deployed in Iraq in 2005, according to the president’s office, and later received military honors for his service there.
After he returned from Iraq, he joined the Republican Guard, which is part of the national gendarmerie and provides officers for the security of French institutions. He was a guard at the Élysée Palace between 2006 and 2010, and joined the gendarmerie unit in southwestern France in August. He and his wife did not have children.
Almost 250 people have died in terrorist attacks in France in recent years. Colonel Beltrame is the 10th member of the nation’s security forces to be killed in a terrorist attack on French soil since 2012, as police and military officers have become regular targets of jihadists. In April 2017, Officer Xavier Jugelé, 37, was shot dead on the Champs-Élysées.
The Paris prosecutor François Molins said at a news conference on Friday night that the terrorist threat had not waned, calling it “the result of radicalized individuals who are on our national territory.”
The attack at Trèbes could increase pressure on the French government to take a more aggressive stand on the thousands of people on the security services’ terrorism watch lists.
The far-right leader Marine Le Pen of the National Front criticized Mr. Macron for not following the Front’s prescription for those on the list: expulsion.
“When will the government understand that we are at war?” Ms. Le Pen tweeted.
Mr. Macron has already shown signs that he will present a tougher face on terrorism than his predecessors, recently promising to set up special “watertight” units in the country’s prisons for a burgeoning radicalized population.
On Saturday, the president’s office asked the French people to honor the memory of the officer, who had fallen “as a hero.” The hashtag #ArnaudBeltrame was among the top trends on Twitter in France on Saturday, as social media users celebrated the officer’s memory. #TousGendarmes, or #AllGendarmes, was also trending.
Mourners placed flowers in front of the gendarmerie headquarters in the French medieval city of Carcassonne to pay tribute to the officer. Officials ordered flags at all gendarmeries to be flown at half-staff.
The police on Saturday arrested a 17-year-old friend of Mr. Lakdim’s on charges of criminal association in connection with a terrorist enterprise. A woman, identified by Mr. Molins as Mr. Lakdim’s partner, was taken into custody Friday night on the same grounds.
In a coincidence, the local newspaper La Dépêche du Midi reported that last year, Colonel Beltrame led 60 police officers in a simulated exercise of a mass killing at a supermarket.
Colonel Beltrame told La Dépêche du Midi in December, “We want to be close to the real conditions, so there is no pre-established scenario.”
A video shot at that time showed police officers armed with paintball guns surrounding an abandoned building and later holding a man on the ground.