A Tunisian terrorist who stabbed to death a police employee outside Paris watched Islamist propaganda videos moments before the attack.
Jamel Gorchene, 36, was on Friday shot dead by police after carrying out a knife attack at a police station in Rambouillet, about 57 kilometres south-west of Paris.
Prosecutors say he ran into the building's entry hall before grabbing the victim, a 49-year-old mother-of-two, from behind and stabbing her in the stomach and throat while yelling "Allahu Akbar".
An officer shot Mr Gorchene after he refused to drop his 22-centimetre blade. He died at the scene.
Gorchene was from M'saken in Tunisia, the same hometown as terrorist Mohamed Lahouaiej-Bouhlel, who killed 89 people when he drove a truck into crowds on Bastille Day in Nice, France, in July 2016.
Like Lahouaiej-Bouhlel, Gorchene was unknown to French intelligence services and had no criminal record.
Counter-terrorism prosecutor Jean-Francois Ricard said Gorchene had watched videos of songs praising extremist Islamist fighters on his phone moments before the attack.
"The attacker, just before carrying out his act, had looked at religious chants and videos," Mr Ricard said. "His radicalisation appears little in doubt."
Gorchene's father told prosecutors his son had "adopted a rigorous practice of Islam".
"He also said that he had noticed behavioural troubles since the beginning of this year," Mr Ricard said.
Video surveillance cameras recorded Gorchene attending a temporary prayer hall in Rambouillet on the day of the attack.
Five people, including Gorchene's father and two cousins, were taken in for questioning.
A couple who housed the attacker after he arrived illegally in France in 2009 were released without charge.
Gorchene obtained a French residency permit last year and last month returned to Tunisia to visit his family – his first trip home since he left for France.
He had only recently moved to Rambouillet from Nice and was working as a taxi driver.
Mr Ricard said investigators were working with Tunisian authorities, while Tunisia's embassy in Paris said it "strongly condemned the barbaric act".
On Monday French police were due to gather in front of police stations across the country to pay tribute to the woman.
The knife attack is the latest in a spate of violent acts, including the killing of schoolteacher Samuel Paty last year, after pupils were shown cartoons from the satirical magazine Charlie Hebdo.
Mr Ricard said the Rambouillet incident was the 17th terrorist attack in France since 2014.
Posts on Gorchene's Facebook page suggest he was inspired by the murder of Mr Paty, after which the Tunisian embraced "an ideology that legitimises violence against those who offend the prophet, Mr Ricard said.
One of Gorchene's cousins said he was suffering from depression and was seeing a psychiatrist in France. She said he was due to return home to Tunisia on Sunday.
"We are all shocked and we cannot believe what happened," she said. "He was an easy prey. People took advantage of his fragile state to radicalise him."
French President Emmanuel Macron on Saturday visited the police station in Rambouillet, as well as the bakery owned by the victim’s husband.
Interior Minister Gerald Darmanin said the government would present new anti-terrorism measures, including increased use of computer algorithms to detect potential threats among internet users.
"We are now dealing with isolated individuals, increasingly younger and unknown to intelligence services, and often without any links to established Islamist groups," he told the Journal du Dimanche newspaper.
The period during which convicted terrorists will be subject to “administrative constraints” after leaving prison will be extended from one year to two.
Earlier this year, parliamentarians in France's lower house backed the bill that President Macron said was designed to rid the country of extremism and protect French values.
New laws will also implement stricter monitoring of the country's mosques and schools after a wave of extremist attacks.
Other elements include ensuring that children attend regular school from the age of 3 in a move to deter ideology being taught in the home. All public employees will be trained in secularism.
The so-called anti-separatism bill, which was fast-tracked after Mr Paty's murder, was perceived by critics to single out Muslims and intrude on basic freedom, while Mr Macron was accused of pandering to right-wing voters before next year’s presidential election.
On Friday, Mr Macron said that "in our fight against Islamist terrorism, we will never give in".
The issue of violence against police is likely to play a part in the election, as security and immigration are already major concerns.
Opinion polls show Mr Macron in a tight race against far-right leader Marine Le Pen, who after the attack accused the government of failing to eradicate extremism.
However, some critics say Mr Macron's efforts to tackle the problem, including making it easier for authorities to track foreign funding of mosques, could stigmatise and alienate French Muslims.