The man shot dead by police in London after a stabbing attack that injured three people Sunday has been identified as an ex-con who served prison time for terrorist offenses — and was released just days earlier.

Sudesh Amman, 20 — who was shot and killed after the 2 p.m. attack in Streatham in south London — had been let out of lockup a week ago, where he was serving time for charges of disseminating and possession documents containing terrorist information, the BBC reported.

He was released after serving only part of his three-year-and-four-month sentence, according to The Guardian.

Amman came to the attention of counter-terrorism authorities in April when investigators learned of postings on a messaging app, which included a photo of a knife, two guns and a Shahada flag with the Arabic words for “Armed and ready April 3,” the outlet said.

Police said he also sent videos to relatives and acquaintances on a WhatsApp group, including images of beheadings he sent to his girlfriend.

“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 the tourists (crusaders), police and soldiers of taghut or Western Embassies in every country you are in this planet,” he wrote to her, the BBC said.

He was first arrested in May 2018 on suspicion of planning a terrorist attack and pleaded guilty to the terrorist documents and publications charges in November of that year.

On Sunday, police said he assaulted several people in the busy London neighborhood, wounding three people — including one with life-threatening injuries — in a “terrorist-related” attack.