The 45-year-old computer expert had been in contact with members of Salafism, an ultra-conservative branch of Sunni Islam, and defended “atrocities committed in the name of that religion”, Jean-Francois Ricard told reporters.
Three police officers and an administrative worker — three men and one woman — died in the lunchtime attack on Thursday at the police headquarters, a stone's throw from the Notre-Dame cathedral in the historic heart of Paris.
The assailant, named as Mickael Harpon, was shot dead by a policeman, who was a trainee at the police headquarters.
The attack sent shock waves through an embattled French police force already complaining of low morale and has raised serious concerns over security procedures.
Harpon, born on the French overseas territory of Martinique in the Caribbean, converted to Islam about 10 years ago, the prosecutor said.
He had no police record but was investigated for domestic violence in 2009.
Sources said he had worked in a section of the police service dedicated to collecting information on jihadist radicalisation.
Harpon held a high-level “defence secrets” security clearance, which authorised him to handle sensitive information of national defence importance and would have subjected him to regular, stringent security checks.
On the morning of his “extremely violent” attack, Harpon bought two knives — a 33-centimetre long kitchen knife and an oyster knife — which he kept hidden, Ricard said.
He showed “absolutely no signs of nervousness” as he circled back to police headquarters, according to CCTV footage examined by police, the prosecutor said.
The attack, from his return to the office, the killings and his death by police bullets, lasted seven minutes, Ricard said.
He first killed a 50-year old police major and a 38-year old guard who worked in the same office as Harpon and were having lunch at their desks.
He then went to another office on the same floor where he killed a 37-year old administrative worker.
Having failed to enter another office, which was locked, he went down into the courtyard where he stabbed a 39-year old policewoman who later died of her wounds.
He then injured two other people, before the trainee policeman killed him with two shots.
Shortly before the attack he had exchanged 33 text messages with his wife.
The messages exclusively concerned religion, and the attacker ended the conversation with “Allahu Akbar” (“God is greatest”) and told her to “follow our beloved prophet Mohammed and meditate on the Koran”, according to the prosecutor.
She was being held by police on Saturday. Harpon, who supported the Charlie Hebdo attacks in 2015, had changed his attire in recent months, shunning “all Western clothes in favour of traditional garments to visit the mosque”, Ricard added.
He also wished to no longer “have certain kinds of contact with women”.
French President Emmanuel Macron, who has described the attack as a “veritable tragedy”, will lead tributes to the victims on Tuesday, the Elysee announced on Saturday.
Sources at the Paris prosecutor's office said on Friday the case had been passed to the anti-terrorist prosecutor's office (PNAT).
After Saturday's news conference by the anti-terror prosecutor, Interior Minister Christophe Castaner came under pressure from political opponents who demanded his resignation.
They also called for an inquiry into how Harpon could have failed to attract the attention of security services in the run up to the attack.
“It's going to be hard to explain how he kept below the radar” of anti-terror units, said one police source.
“There's a storm coming,” the source said.
Prime Minister Edouard Philippe meanwhile expressed his “full confidence” in Castaner. But in an interview with weekly JDD to be published Sunday, he also said that procedures for the detection of signs that anti-terror agents may themselves have been radicalised would be probed.
Paris's top policeman Didier Lallement said there was no reason to question security arrangements in police headquarters.
French police have been a recurring target of jihadist groups, such as Islamic State, behind a wave of attacks since 2015 — from large synchronised assaults to isolated knife and gun attacks.
In June, a parliamentary report on radicalisation within the public services spoke of 30 suspected cases out of the 150,000 police officers and 130,000 gendarmes in France.