The man who killed 86 people in Nice by driving a lorry through a crowd has been named as a Tunisian delivery man, Mohamed Lahouaiej-Bouhlel - not a known jihadist.
French Interior Minister Bernard Cazeneuve said the killer had apparently been radicalised very quickly.
Lahouaiej-Bouhlel, 31, was identified by his fingerprints after his driver's licence, mobile phone and credit card were found inside the vehicle by police who had shot him dead.
He had reconnoitred the area in the lorry on the two days before the 14 July Bastille Day attack, when he smashed into the crowd on Nice's famous beachfront, the Promenade des Anglais.
So-called Islamic State (IS) says he acted in response to its calls to target civilians in countries that are part of the coalition ranged against the group.
'Far from religion'
Lahouaiej-Bouhlel was from the north Tunisian town of Msaken, about 10km (6 miles) outside the coastal city of Sousse.
It has emerged that he had a history of violence and mental instability.
Neighbours in Nice described him as a violent loner who liked to drink, lift weights and go salsa dancing.
He lived a life "far from religion", eating pork, taking drugs and indulging in a "wild" sex life, French prosecutor Francois Molins said.
But he had a "clear and recent interest" in radical Islamist movements, Mr Molins said.
From 1 July, Lahouaiej-Bouhlel made more or less daily internet searches for verses of the Koran and "nasheeds" - jihadist propaganda chants. He also researched the Islamic holiday of Eid al-Fitr.
Investigators found photos of dead bodies and images linked to radical Islamism on his computer, including the flag of so-called Islamic State, the cover of an issue of French satirical magazine Charlie Hebdo - attacked by gunmen in January 2015 - and photos of Osama bin Laden and Algerian jihadist Mokhtar Belmokhtar.
In the eight days leading up to the attack, he grew a beard and told friends this was for "religious reasons".
He also told them he did not understand why IS could not hold territory and showed them a video of a beheading on his mobile phone. In response to their shock, he said he was "used to it".
However, there was no evidence that he had pledged allegiance to any radical groups or had contact with known Islamists.
'Premeditated and deliberate'
Examinations of Lahouaiej-Bouhlel's browsing history also showed he had carried out research for his attack.
On 1 July he searched for details of the Bastille Day celebrations in Nice as well as videos showing "terrible" fatal traffic accidents.
In the days before the attack, he twice drove to the Promenade des Anglais in his rented lorry, sold his van and attempted to withdraw money, Mr Molins said.
This showed that his act was "premeditated and deliberate", he said.
He reserved the 19-tonne refrigeration lorry on 4 July and collected it on 11 July in Saint-Laurent-du-Var, just west of Nice.
During his reconnaissance trips, he sent a selfie photo from the driver's cabin.
Just minutes before launching his attack, he sent text messages asking accomplices to give him more weapons and boasting about having obtained a pistol. He fired that pistol at police during his rampage, before police shot him dead.
"Bring more weapons, bring five to C," one of the messages said.
Police are trying to identify who the message was sent to.
Four men who knew Lahouaiej-Bouhlel are being questioned by police, as are an Albanian couple suspected of having given him logistical help.
Police say Lahouaiej-Bouhlel was married with three children, although he no longer lived with his wife. She was detained for questioning by police on 15 July but has since been released.
A woman who knows the family told the BBC Lahouaiej-Bouhlel had been thrown out of their home in the Le Ray area of Nice more than a year ago after allegedly beating his wife.
Lahouaiej-Bouhlel last visited Tunisia four years ago, people in his hometown Msaken told the BBC's Rana Jawad. They said many people knew his family and were shocked by his actions.
"We remember him as a normal person from a wealthy family," a town resident told her.
While many who knew him described Lahouaiej-Bouhlel as being secular, other witnesses pointed out that more recently he had displayed outward signs of becoming more religious.
A psychiatrist, Chamseddine Hamouda, carried out a mental assessment of the killer a few years ago after his father became concerned about his "troubling behaviour of a psychotic nature".
"He was a stranger to himself," Mr Hamouda said. "I advised his parents that he needed treatment.
"At the time he exhibited violent behaviour towards his family... I'm sure that in the past 12 years something else happened that perhaps influenced how he thought."
He was "quiet", a "loner" who did not respond to greetings, according to several neighbours in the four-storey block of flats in the Abattoirs area of Nice where he lived.
He had a van parked nearby and would often be seen climbing the stairs to his first-floor flat, carrying his bike.
Anan, who lived on the ground floor, said she had been suspicious of him because he was "a good-looking man who kept giving my two daughters the eye".
One woman recalled that he had been nice to her and had helped her all the time. But, she added, his behaviour had sometimes been "strange".
Lahouaiej-Bouhlel had been in trouble with police between 2010 and 2016 for threatening behaviour, violence and petty theft.
In March, a court in Nice convicted him of assaulting a motorist with an improvised weapon - a wooden pallet - during an altercation. He was given a six-month suspended prison sentence and ordered to contact police once a week, which he did.
Lahouaiej-Bouhlel was "never flagged for signs of radicalisation", officials say, and he was not on France's "Fiche S" high-security watch list.
The majority of attacks carried out in the country since January 2015 have been staged by men designated "Fiche S", and also linked to IS.
In 2014, IS spokesman Mohammed al-Adnani told supporters in an audio message: "If you can't detonate a bomb or fire a shot, manage by yourself... run them over with your car."
Many of France's jihadist killers, starting with Mohammed Merah in Toulouse in 2012, also began their journey towards militant Islam as petty criminals.