The rap sheet against Radouane Lakdim, a French citizen born in Morocco according to sources close to the inquiry, eventually drew deeper scrutiny by investigators worried he was at risk of Islamic radicalisation.
In the summer of 2014 Lakdim, who lived in Carcassonne, was put on a watchlist of people considered possible extremists.
“He was added to the list because of his radicalisation and his links with the Salafist movement” of ultra-conservative Islamism, Francois Molins, France's top anti-terror prosecutor, said at a press conference in Carcassonne.
He was found guilty of carrying a prohibited weapon in 2011 and later for drug use and refusing a court order in 2015, Molins said.
In 2016 then in 2017 he was the subject of an investigation by intelligence services, “which did not bring to light any sign that would indicate he would carry out a terrorist act,” he added.
But when entering the Super U supermarket in nearby Trebes on Friday, Lakdim shouted “Allahu Akbar” (God is greatest), declared he was ready to die for Syria, and demanded the freedom for his brothers” before shooting and killing a client and an employee.
“He was just a regular kid, from a simple and regular family. He wore a beard and didn't have a job,” a neighbour told AFP, asking to remain anonymous.
Le Parisien newspaper reported that Lakdim lived with his parents, and quoted a neighbour saying he had dropped off a little sister at school on Friday morning.
On Friday night a massive police operation was being carried out at the Ozanam housing estate in Carcassonne where Lakdim lived, not far from the police headquarters where he shot at officers earlier.
“We're in a state of siege,” one resident at the scene said by phone as heavily armed and masked officers carried out searches.
Few people were willing to talk to reporters, including a relative reached by telephone who quickly hung up.
The estate has seen an increase in recent years of the kind of drug-dealing and vandalism that have blighted many poor districts across France.
“We've been alerting the authorities for a while now, there's dealing, there are guns going around, we hear gunshots,” one retired woman told AFP.
A man in his 40s said he arrived in Ozanam when he was 14, “but now, I'm getting my mum out, she's had two of her cars set on fire.”
But others said it was no worse than other housing estates, and said there had been no signs of radicalisation with Lakdim or other youths.
“He wore a beard but he was just a regular kid,” one neighbour said.
“He came out twice a day to walk his dog; we were really surprised to learn it was him.”
But Lakdim's trajectory appears to have followed a grimly familiar pattern in France over recent years of young men progressing from petty crimes into terrorism, often despite surveillance by the authorities.
Since the January 2015 massacre at the Charlie Hebdo newspaper in Paris by two men claiming allegiance to Al-Qaeda and the Islamic State group, more than 240 people have been killed in jihadist attacks.
After the Stade France and the Bataclan concert hall and nearby bars in November 2015, investigators found that the ringleader Abdelhamid Abaaoud and Salah Abdeslam, the only surviving gunman, had both served time for robbery around 2011.
A string of deadly gun and knife attacks has followed, and Interior Minister Gerard Collomb has said dozens of others have been thwarted by police as the government stepped up anti-terror measures.
In Carcassonne itself, police had arrested a 22-year-old man in June 2016 on suspicion of planning to target American and Russian tourists, after months of surveillance.
“The acts carried out today sadly remind us once more, tragically, that the terrorist threat level on our territory has not lessened,” Molins said.
“Now mainly internal, it is first of all the result of radicalised individuals living in our country,” he said.