Khairi Saadallah had a history of mental health issues, debt and homelessness, according to court documents.
The 26-year-old, who prosecutors insist was motivated by terrorism, arrived in the UK as a refugee, having fled the civil war in his home country of Libya in North Africa.
Saadallah was known to security services prior to the fatal knife attack in a Reading park in June, in which he murdered James Furlong, 36, David Wails, 49, and Joseph Ritchie-Bennett, 39, and injured another three people.
He briefly came to the attention of MI5 last year, but the information provided did not meet the threshold of investigation.
A security source previously said MI5 had received intelligence he planned to travel abroad, possibly for terrorism purposes, but the threat was found to be “insubstantial”.
Saadallah had six previous convictions for 11 crimes between June 2015 and January last year, according to a 2019 Court of Appeal judgment.
He was originally jailed for 25 months and 20 days in October 2019 for a string of crimes but the sentence was later reduced, the papers show.
Offences included racially aggravated assault, knife offences and criminal damage.
In November 2018 he called a police officer a “slave” and spat in her face while being detained under the Mental Health Act in response to reports he was attempting suicide.
The police officer described the act as “being the vilest thing she had been subjected to as a police officer”, according to the court documents.
He admitted possessing a bladed article and criminal damage after being found “apparently very drunk” by police officers in December 2018 with a butter knife in his waistband, claiming he was “out for revenge”, the judgment said, having “been attacked” and left with a head injury that required stitches.
While in custody he defaced a copy of the police code of practice “with his own excrement”.
In January 2019 he was also involved in an altercation with a security guard, during which he struck the man in the face with his belt, court documents show.
He was convicted of affray and assault by beating an emergency worker.
Security guard Sydney McDonald, 65, told the PA news agency he was assaulted by the suspect last year when he stopped him from shoplifting from the Sainsbury’s store where he works in Friar Street in Reading town centre.
Mr McDonald said he recognised him from when he was attacked with a belt by a man brandishing a broken wine bottle.
In September 2019 Saadallah was jailed for 10 weeks after admitting spitting at District Judge Sophie Toms as she sentenced him six months earlier at Reading Magistrates’ Court for two previous convictions.
He had also breached an earlier suspended sentenced for carrying a knife in a plastic bag at a supermarket, according to the court papers.
Saadallah, who had lived in Basingstoke Road in Reading, had his overall sentence reduced to 17 months and 20 days behind bars at the Court of Appeal in March this year.
His mental health problems were noted by Mr Justice Goss, one of the appeal judges who handed down the judgment.
According to the court papers, he had a history of debt and homelessness, alcohol and substance misuse, and “suffered from the effects of” post-traumatic stress disorder, depression and a personality disorder.
In the document he was also described as being “aggressive and unpredictable”.
In the judgment Mr Justice Goss said the sentencing judge had “observed that numerous outside agencies had attempted to help him, but he kept on committing deeply unpleasant violent offences”.
It is understood Saadallah was released from prison in June and the Covid-19 pandemic played no part in the decision to free him.
He left HMP Bullingdon, Oxfordshire, after serving less than half of his sentence, according to The Sun.