Khalid Ali was carrying three knives when he was tackled by armed officers near Downing Street in April 2017 - and was just moments from being able to attack police, politicians or military personnel.
But clues picked up from bomb parts recovered in Afghanistan five years earlier meant he was under surveillance by the police and MI5.
Ali, who is one of the seven children, was born to an Ethiopian mother and Somali father in Saudi Arabia, to which the family moved to escape civil war in Ethiopia and from where - in 1992 - they came to the UK.
He grew up in Edmonton and trained as a gas engineer and plumber after leaving school, but in his late teens became increasingly absorbed by religion and politics.
Missing for five years
In 2010, Ali travelled on an aid convoy to Gaza, appearing in news reports after a shipping dispute resulted in some of the travellers being forcibly taken to Greece.
Kieran Turner, who helped organise the convoy, told the BBC: "At that point I thought 'nice young man - this is going to be one of the people that's fun to travel with'."
Ali "had a sense of humour" and "always smiled", Mr Turner recalled.
But Ali was a more complex figure than he appeared.
In June 2011 he told family members he was moving to Birmingham for work. They would not hear from him for more than five years.
He was reported missing and, during subsequent inquiries, a laptop from his bedroom was found to contain speeches by the al-Qaeda ideologue Anwar al-Awlaki encouraging people to engage in military jihad.
In truth, Ali had gone to Afghanistan to join the Taliban.
There, according to Deputy Assistant Commissioner Dean Haydon, senior national co-ordinator for counter-terrorism policing, he went to a "Taliban training camp affiliated to al-Qaeda where, for several years he helped terrorists make hundreds of bombs capable of mass murder".
In late October 2016, Ali suddenly appeared at the British consulate in Istanbul, Turkey, claiming to have lost his passport and seeking a temporary travel document in order to get home.
Two days later, without luggage or possessions, he landed at Heathrow and was immediately questioned under terrorism laws.
Ali claimed to have spent the preceding years travelling in northern Pakistan rediscovering himself and learning about different sects of Islam.
Without lawful reason for further detention he was released but - crucially - only after his fingerprints were taken.
These were shared with the FBI, which manages a vast database containing fingerprints found on bomb parts in various global conflict zones.
Ali's prints were matched to some found on improvised explosive device (IED) components from two large caches recovered by Afghan national security forces - the main targets and victims of such weapons - in South Kandahar Province more than four years earlier.
Eventually, 42 prints from the Afghan IED components were positively matched to Ali.
Detectives applied to the US for the evidence to be declassified so he could be prosecuted in the UK but permission was not instant.
In the meantime, Ali, unaware of these developments, appeared to resume normal life in London. He moved back to the family home in Edmonton, found work in a west London pizza takeaway and started retraining as a gas fitter.
However, he was also quietly planning an attack and began researching targets.
In March 2017 he was spotted at a march in central London, behaving suspiciously towards police officers outside Downing Street.
Then in April he conducted reconnaissance of sites including the MI6 building and New Scotland Yard.
From then on events moved quickly.
On 25 April, near his workplace in Ealing, he bought a set of knives and a sharpener.
The following day, officers observed him buying a mobile phone.
That night, he was watched emerging from the family home and putting a plastic bag into a wheelie bin outside another house.
When retrieved, it contained packaging for kitchen knives and a sharpener.
While her son had been outside, Ali's mother - concerned by his behaviour - went to his room and found four knives, which she took to a different part of the house.
"I was shocked and upset" and "scared at what he'd do with them", she said in a statement read at Ali's trial.
On his return an argument broke out when Ali realised the knives were missing.
His mother called the police.
Local officers attended and Ali left the property after midnight when his mother made it clear she wanted him to go.
Armed with knives
He then set about rearming himself.
At daybreak he travelled across London, to Ealing, where he lingered for several hours before purchasing three kitchen knives and heading for Westminster - the location where, just weeks before, another attacker, Khalid Masood, had murdered five people, including a police officer.
He walked around Parliament Square, dumping items in different locations, including a mobile phone in the River Thames that was later found to contain images of police officers in stab vests.
When he walked towards Whitehall in the direction of Downing Street, armed police moved in.
Knives were found in both jacket pockets and one tucked down the front of his trousers.
Asked whether the public were in danger, Ali said he was not interested in them. Asked if anyone else was at risk, he told the officers: "You lot are carrying weapons, so you must know you are in danger."
Deputy Assistant Commissioner Haydon said: "Police and security services were managing any potential risk that he posed and he was arrested at the most appropriate time."
It was only in the hours after Ali's arrest that permission was granted to use the evidence from the explosives in a British prosecution.
During lengthy police interviews in the following days, Ali said he was armed only for his own protection and had not been planning an attack.
He claimed to have been in Westminster to give a "message" to those in authority about his beliefs, which he had returned to the UK to deliver.
Detectives were told the message was the same as one previously delivered by al-Qaeda leader Osama bin Laden.
Ali said he was a soldier of the Taliban and that al-Qaeda was its military wing.
He admitted constructing explosives in Afghanistan - and when asked whether he had also detonated them, Ali said: "I have pressed the button."
A detective asked: "How many times have you pressed the button to cause an explosion?"
"Probably more than 300 times," he replied.
"I've been training and fighting against Western troops, be it American or British," he told officers.
He later added: "I'm sitting here in front of you as a mujahid, as classified under your country, the law, as a terrorist."
Ali was asked: "Did you kill any British troops while you were in Afghanistan?"
"I will remain silent for now," he replied.
In court, Ali changed his account, telling the jury he had been held captive in Pakistan, near the Afghan border, and forced to bundle up components of explosive devices to prove he was not a British spy.
He denied planning an attack in London to coincide with the start of the Taliban "spring offensive" the following day.
Under cross-examination, he denied that the mobile phone purchased the night before his arrest - which has never been recovered - was used to contact the Taliban to get instructions to launch his attack.
But he was found guilty of preparing terrorist acts and two counts of possession of an explosive substance with intent.