The Streatham attacker was released from a high security prison with investigators fearing he believed terrorist atrocities to be justified, the Guardian has learned.

Sudesh Amman, 20, was placed under full surveillance from a unit of 30 officers on the day of his release from Belmarsh prison and within days prompted such concern from counter-terrorism officials that those tailing him were ordered to be armed.

In prison he had declined to engage in programmes to manage his risk, and his behaviour during his sentence for terrorist offences following a 2018 conviction caused concern.

One source with knowledge of the Amman case said: “He was as much a problem when he came out of prison as when he went in.”

Officers were following Amman on Sunday as he started stabbing people with a knife he stole in a shop, days after controversially being released from a sentence for terrorism offences.

Less than 10 seconds after he started his attack on Streatham High Road, armed surveillance officers who had been following him around the clock engaged him. He was shot dead less than 60 seconds after his attack began.

One man, who was initially considered to be in a life-threatening condition, is still in hospital.

The armed officers tracking Amman were part of a 24/7 surveillance operation, which is more expensive than keeping him in prison. He was released on 23 January, barely a week before he stabbed two people.

His release from jail was automatic at the halfway point of his sentence. It is understood that there was no mechanism for a risk assessment to be factored into whether he should be freed.

Powerless to stop him being released, prison and probation officials met with police to discuss the serious danger he was seen as posing. He was assessed as posing the highest risk, and they agreed to impose licence conditions on his release including the wearing of an electronic tag, a curfew, where he could go and restrictions on internet use.

Police and MI5 also committed extensive resources to place Amman under round the clock surveillance – itself rare and a sign of the danger he was thought to present. The case was considered among the highest priorities by investigators and analysts trying to thwart an atrocity.

On Monday evening police said that armed officers had been following Amman as he left a hostel at around 1.20pm on Sunday. Initial witness statements suggest that shortly after he entered a shop he stole a knife and then ran out as he was pursued by a member of staff.

As he ran from the shop, he removed packaging from the knife, and once outside attacked two members of public, the police said.

He is thought to have been wearing his fake suicide vest covered by a jacket, and thus out of view of the surveillance team following him.

Police have identified around 50 witnesses from whom they are gathering statements and are trawling through CCTV footage of the incident.

Tell us: have you been affected by the Streatham attack? Read more

Amman, from Harrow in north-west London, was jailed in December 2018 at the age of 18 after admitting to 13 counts of supporting Islamist terrorism and possessing and sharing Islamic State and al-Qaida propaganda in a family WhatsApp group and on social media. He was sentenced to three years and four months in jail, and served half that time in Belmarsh high security prison, taking in time he had already spent on remand.

He had come to police attention in April of that year for posting extremist material and was arrested a month later. At his trial it emerged he had expressed support for Isis and its then leader Abu Bakr al-Baghdadi and sent beheading videos to his girlfriend, advising her to kill her “kuffar” (unbelieving) parents. Amman also wrote about the desirability of conducting a terror attack: “If you can’t make a bomb because family, friends or spies are watching or suspecting you, take a knife, molotov, sound bombs or a car at night and attack.”

Mark Lucraft, the trial judge, wrote in his sentencing remarks: “In terms of mindset, your interest in Islamic extremism and Daesh appears to be more than just an immature fascination. It seems to me on the material here that you are someone with sincerely held and concerning ideological beliefs,” before adding a warning that turned out to be prescient.

“You speak about preferring a knife attack to the use of bombs and ask about having a knife delivered to her [his girlfriend’s] address”.

Senior government officials believe the current law gives them no power to check if someone still poses a danger and to block their release at the halfway point of their sentence.

But soon after this decision, he was assessed to be even more dangerous than first thought and surveillance officers were ordered to be armed, multiple sources said.

The armed surveillance officers were carrying concealed pistols for their own personal protection and hence were able to stop Amman when he struck.

After his conviction, acting Met Commander Alexis Boon, head of the Metropolitan police’s counter-terrorism command, said Amman had a “fascination with dying in the name of terrorism”, as seen in a notepad recovered from his home. “Amman had scrawled his ‘life goals’ in the notepad and top of the list, above family activities, was dying a martyr and going to ‘Jannah’, the afterlife,” she said.