The man who killed four people at the Paris police headquarters followed a radical vision of Islam before the attack, the French anti-terrorism prosecutor said on Saturday.
The attacker was shot dead by police at the scene on Thursday.
In the weeks leading up to the attack, he had adopted an increasingly radicalised behaviour, the prosecutor said, justifying the terror attacks on Charlie Hebdo newspaper that left 12 dead in Paris in 2015, trading his clothes for traditional religious ones and stopping to have contact with women.
Only 30 minutes before he knifed three police officers and one administrative assistant to death in their offices, he sent text messages including the words "Allahu akbar", prosecutor Jean-Francois Ricard said.
"Contacts between the attacker and some individuals of the Salafist movement" were discovered during the investigation, which is led by the Paris anti-terror unit, Ricard added.
Named as Michael H., 45, the attacker worked as an administrative assistant at the intelligence department of the Paris police headquarters, where he had been employed since 2003.
The prosecutor described a "scene of extreme violence". In his killing spree, which lasted seven minutes between 12:53 and 13:00 CEST, Michael H. entered his office of the police headquarters, mortally wounding two police officers who were having lunch, then trying to enter another office where three others were on a break but could not go past the locked door. He then attacked another employee, who died of her injuries, and wounded another before he was stopped by a 24-year-old intern, who shot him.
He used two knives — one of them an oyster knife — he had bought on the morning of the attack.
He had no criminal record, but had been charged, and eventually acquitted, of domestic violence.
His wife, 38, remains in custody, the prosecutor said.