Ziamani was convicted in February of "engaging in conduct in preparation of terrorist acts" and sentenced Friday at the Old Bailey to 22 years in prison.
It's a case with chilling echoes of the shocking murder by two Islamist extremists of soldier Lee Rigby, mowed down and hacked to death with a machete on a street in Woolwich, in southeast London, in May 2013.
On the morning of his arrest, Ziamani had told his former girlfriend he intended to attack and kill soldiers. He also showed her the long-bladed knife and the hammer in his bag.
Police who had searched his home two months previously had found a handwritten letter in which he glorified the murder of Rigby, and stated that "we should do a 9/11, 7/7 and a Woolwich all in one day."
Police said Ziamani, who was unemployed, had come under the influence of a banned London-based terrorist organization "that it is believed played a major role in influencing and shaping his radical views." That organization is Al Muhajiroun, also known as ALM.
Handing down the 22-year sentence, Judge Timothy Pontius said the police had put together a "formidable and unassailable" case against the teenager.
"Ziamani's coldblooded deliberation under the malign influence of ALM, of whom he was a willing student, showed in court that he was far from the naive adolescent that the (defense) tried to portray him as," he is quoted as saying in a police statement.
"He is a man of intelligence and independent and articulate mind. He was within hours of carrying out his intention of murdering a soldier, police officer or government official to imitate the horrifying savagery carried out by the killers of Lee Rigby."
Letter found in jeans
The letter that came to light when counterterror officers from London's Metropolitan Police searched Ziamani's address in June gave an insight into an extremist mind-set that already had violence in mind.
Found in a pair of jeans, according to police, the letter was messily written with many misspellings.
In it, he tells his "beloved parents" that what he's about to do is an obligation for Muslims and asks them to forgive him for all the stress he's caused them in the past.
"I'm a changed person," he said, saying he has to act to help his "brothers and sisters" in Syria and Iraq.
Because he does not have the means to get to these countries, he will wage war against the British government here instead, he said, adding that it would give the authorities "a taste of there (sic) own medicine."
Ziamani admitted writing the letter and was arrested on suspicion of committing a terrorism offense. He was released on bail, allowing police to continue their inquiries.
Police believe he converted to Islam in April 2014 and point to his postings on social media as evidence of his rapid radicalization.
In May he posted "Land of democracy = Evil," and in July he posted, "Forget the protests, the only way to liberate Muslim lands is Jihad."
On June 20, Ziamani had used his phone to visit websites researching the locations for army cadet bases across London, police said.
'Extremely dangerous individual'
While Ziamani was out on bail, officers tasked with trying to divert vulnerable young people from the path to radicalization tried to meet with him three times, but he declined to engage with them, police said.
Commander Richard Walton of the Counter Terrorism Command welcomed the sentence, saying he was "relieved an extremely dangerous individual" had been removed from the streets.
"Ziamani was an impressionable young man who became radicalized, then rapidly developed an extremist, violent mind-set," Walton said.
The work of police and intelligence officials had "probably prevented a horrific terrorist attack taking place on the streets of London," he said.