Troops at Paris' Orly airport on Saturday shot dead a man who tried to grab a female soldier's weapon saying he was ready to die for Allah, triggering a major security alert that caused travel chaos.
The incident comes as France remains on high alert following a series of jihadist attacks that have claimed more than 230 lives since January 2015.
Prosecutors said they had opened an anti-terror investigation.
"Put your weapons down. I'm here to die for Allah. In any case people are going to die," the man told three patrolling soldiers, Paris prosecutor Francois Molins told reporters late Saturday, giving an account of the attack.
A cousin of the attacker was also detained, as well as his father and brother, he added.
Flights were halted at Orly for several hours, with incoming flights diverted and thousands of passengers stranded at Paris' second-largest airport, but normal service resumed mid-afternoon.
France goes to the polls on April 23 in the first round of a two-stage presidential election in which security is one of the main issues on voters' minds.
Interior Minister Bruno Le Roux said the attacker, who he named as Ziyed Ben Belgacem, was "known to the police and intelligence services".
He said the suspect was also linked to an attack on police just north of Paris earlier on Saturday in which an officer was slightly wounded.
At the airport, the 39-year-old man knocked the soldier to the ground and grabbed at her rifle, a senior military source said.
The two other soldiers with her then opened fire, killing him, the source said.
No-one else was injured in the incident.
According to an eyewitness who spoke to AFP, the man had at one point grabbed the female soldier by the neck.
"The man took a soldier hostage, he was holding her by the neck and he was threatening two other soldiers with the woman's rifle," said the man who was catching a flight to the Dominican Republic, who gave his name only as Dominique.
The incident took place at around 8:30 am in the south terminal. Around 3,000 people were evacuated from the building.
Franck Lecam, a traveller bound for Tel Aviv, told AFP he heard "three or four shots" as he was queueing to check in.
Addressing reporters at the airport, Le Roux said Ben Belgacem had tried "but not succeeded" in his bid to grab the soldier's rifle.
He said the same man was also suspected of opening fire on police during a routine traffic inspection in the northern Paris suburb of Garges-les-Gonesse at around 7:00 am (0600 GMT). One officer suffered minor head injuries.
He was thought to have stolen a car and driven to Orly, Le Roux said.
Sources close to the investigation said Ben Belgacem had committed several armed robberies and was investigated for radicalisation in 2015, although he did not feature on the list of those thought to pose a high risk.
He lived in an apartment in Garges-les-Gonesse, which was searched by investigators later Saturday.
Air traffic to Orly was suspended and all incoming flights rerouted to Paris' main Charles de Gaulle airport, north of the city.
Passengers in the western terminal were kept inside the building, which reopened at around 1200 GMT. Operations resumed soon afterwards at the southern terminal, where the incident occurred.
Elite police teams secured the airport and searched it for explosives but none were found.
France "still targeted"
France remains under a state of emergency after a series of terror attacks, including the November 2015 massacre in Paris and a truck attack in Nice last July.
In mid-February, a machete-wielding Egyptian man attacked a soldier outside Paris's Louvre museum before being shot and wounded.
The soldiers on patrol at Orly airport belong to Operation Sentinelle, a force of 7,000 troops deployed in the capital and other cities after the January 2015 attacks in Paris.
On Thursday, a letter bomb exploded at the Paris offices of the International Monetary Fund, injuring a secretary who suffered burns to her hands and face.
French President Francois Hollande called that incident an "attack", saying it showed the country was "still targeted".