Image copyright West Midlands Police

Police have named the London Bridge attacker as Usman Khan, who was previously part of a group that plotted to bomb the city's stock exchange.

Khan, 28, was out on licence from prison when he killed two people and injured three others in the stabbing attack on Friday, before being shot dead by armed police.

Since being released in December 2018 - his conditions requiring him to wear an electronic tag - Khan had been living in Stafford.

He also took part in the government's "Desistance and Disengagement Programme", the purpose of which is the rehabilitation of those who have been involved in terrorism.

In 2012, he was sentenced to indeterminate detention for "public protection" with a minimum jail term of eight years after pleading guilty to preparing terrorist acts.

The sentence would have allowed him to be kept in prison beyond the minimum term, should the authorities have deemed it necessary.

In a reference to Khan and two other defendants, the trial judge said: "In my judgement, these offenders would remain, even after a lengthy term of imprisonment, of such a significant risk that the public could not be adequately protected by their being managed on licence in the community, subject to conditions, by reference to a preordained release date."

He added that the "safety of the public in respect of these offenders can only adequately be protected if their release on licence is decided upon, at the earliest, at the conclusion of the minimum term which I fix today."

Within months of his conviction Khan had been upgraded to a "high risk" prisoner at HMP Whitemoor.

A government source told BBC Look East that Khan became an increased security risk in 2012 "after making threats to senior prison staff".

He was said by the source to have been a "model prisoner" afterwards.

However, a prison source told the BBC Khan had "played everyone" and was involved in lots of security incidents during his imprisonment.

In 2013 the Court of Appeal quashed Khan's sentence, replacing it with a 16-year-fixed term of which half was to be served in prison. He was then released automatically at that point.

Khan was moved to another maximum security prison, HMP Woodhill, prior to his release on license in 2018.

Born and raised in Stoke-on-Trent, Khan was originally jailed along with eight others, who were arrested in 2010.

The nine, inspired by al-Qaeda, had been under surveillance by MI5.

The men - who were from Stoke, Cardiff and London - were engaged in several plans, one of which involved a plot to place a pipe bomb in the London Stock Exchange.

Those from Stoke were overheard discussing potential attacks in their city, including leaving explosive devices in pubs and clubs.

Khan described members of the public as "kuffar" and "dogs".

Image copyright West Midlands Police Image caption Usman Khan, circled, with his fellow defendants in a surveillance image released by police in 2012

At one point Khan was monitored in conversation about "how to construct a pipe bomb" from a recipe in an al-Qaeda magazine.

The men had also been funding a proposed madrassa - a college for Islamic instruction - abroad, which was to be used for firearms training and would have been attended by Khan.

The court of appeal judgement said: "The groups were clearly considering a range of possibilities, including fundraising for the establishment of a military-training madrassa in Pakistan - where they would undertake training themselves and recruit others to do likewise - sending letter bombs through the post, attacking public houses used by British racist groups, attacking a high-profile target with an explosive device and a Mumbai-style attack."

It added that they had "serious long-term plans" to send Khan and other recruits for "training and terrorist experience".

"Should they return to the UK, they would do so trained and experienced in terrorism," the judgement continued.

Another man from Stoke who was jailed alongside Khan - Mohibur Rahman - was later convicted of another terrorist plot following his release from prison.

Khan had spent years proselytising in Stoke on so-called "dawah stalls" linked to the proscribed terrorist organisation al-Muhajiroun, which was once led by the hate preacher Anjem Choudary.

After Khan was jailed, the Daily Star quoted Choudary saying that the Stoke plotters "were students of mine" and "I knew them for quite a while".

In 2008 Khan's address was one of five properties in Stoke raided by counter-terrorism police. None of those investigated was ultimately charged.

Media playback is unsupported on your device Media caption Usman Khan speaking to the BBC in 2008: "I ain't no terrorist"

Speaking at the time, Khan publicly complained about being under suspicion, saying: "I've been born and bred in England, in Stoke-on-Trent in Cobridge."

He said "all the community knows me" and that "I ain't no terrorist".

While incarcerated, Khan attended some counter terrorism programmes and first came into contact with the educational initiative Learning Together, whose event in London he later so brutally attacked.

After leaving prison, Khan appeared as a "case study" in a report by the initiative focused on its work at HMP Whitemoor in Cambridgeshire.

Identified only by his first name, Khan was said - since leaving prison - to have given a speech at a fundraising dinner and been provided with a "secure" laptop that complied with his licence conditions.

Khan contributed a poem to a separate brochure in which he also expressed gratitude for the computer, stating: "I cannot send enough thanks to the entire Learning Together team and all those who continue to support this wonderful community."

The attacker, who was restricted in who he could meet and where he could go, was managed by a panel comprising public bodies - including the police and probation service - under the system of multi-agency public protection arrangements.

The day of the attack was the first time Khan had been allowed to visit London since he left prison.

The panel that permitted his attendance - in order to attend the Learning Together event - also decided he could travel there unescorted.

But when Khan had attended an event elsewhere in the country in May he had been escorted, and - later in the year - Khan was refused permission to travel to Stoke to attend a social event.

He was formally under investigation by MI5 at the time of the attack, classed as one of its 3,000 subjects of interest. He was not placed in the top tiers of those under scrutiny.