A terror suspect who decapitated his boss and took a selfie with the head and flags covered in Islamic writings has killed himself while in prison awaiting trial.

Yassin Salhi, 35, had also tried to blow up an industrial gas factory by driving his car at a pile of inflammable bottles before he was arrested in June. He was formally put under investigation – the French equivalent of being charged – for “murder as part of a terrorist operation, kidnapping and imprisoning with a view to murder, wilful destruction and violence”.

Salhi always denied any terrorist connection, claiming he had cracked after falling out with his employer at a transport company. He was accused of kidnapping Hervé Cornara two days after a quarrel, strangling him and cutting off his head with a knife.

Before placing the head on the gates of the Air Products factory at Saint-Quentin-Fallavier, south-east of Lyon, Salhi took a photograph of himself with his victim, which he allegedly sent to a friend fighting in Syria. Two flags hung nearby were inscribed with the shahada: the Muslim profession of faith and the first of the five pillars of Islam. He then drove his car into the factory and attempted to blow it up by smashing the vehicle into a pile of gas bottles.

Before being arrested, police claim he shouted “Allahu Akbar”.

Salhi, a father-of-three, was being held in solitary confinement, but was not considered a suicide risk.

The Paris public prosecutor, François Molins, under whose jurisdiction Salhi was transferred, told journalists the attack “exactly corresponded to Daesh [Islamic State] orders”, particularly the fact that the accused man had attempted to obtain “maximum publicity” for his act.

Cornara’s widow, Laurence, told radio station Europe 1 she was angry. She said: “I don’t understand how this could have happened. It’s not normal.”

She added: “I was waiting with impatience to find myself face to face with him [in court], to look him in the eye. He was a coward and he would be a coward to the end.”

• In the UK, the Samaritans can be contacted on 116 123. In the US, the National Suicide Prevention Hotline is 1-800-273-8255. In Australia, the crisis support service Lifeline is on 13 11 14. Hotlines in other countries can be found here.