Image copyright Julia Quenzler

A British man tried to strike at "the heart of democracy" with knives four weeks after the terror attack in Westminster, the Old Bailey has heard.

Khalid Ali, 28, was arrested by police near Parliament on April 27 carrying three knives, jurors were told.

Prosecutor Brian Altman QC said Mr Ali wanted to launch "a deadly terror attack" against MPs and the police.

Mr Ali denies preparing acts of terrorism in Britain and two charges of possessing explosives outside the UK.

The court heard Mr Ali, from Edmonton in north London, allegedly spent five years making bombs for the Taliban and fighting British forces in Afghanistan but returned in 2016 to deliver a "message" to the government.

Mr Altman said: "On Thursday April 27 last year this defendant, Khalid Ali, was arrested by armed police officers in Whitehall in Westminster."

"When he was searched he was found to be in the possession of three knives of varying lengths which he had only bought that same day.

"Two knives were found in right and left pockets of his jacket. The longest was removed from the waistband of the tracksuit trousers he was wearing."

Security cameras had tracked Mr Ali from West Ealing to Victoria to Westminster, the court heard.

The prosecutor said if it hadn't been for the interception of the defendant by the police "he would have carried out yet another murderous terror attack in Westminster."

Jurors were told that four weeks before Khalid Masood had driven into four people on Westminster Bridge and fatally stabbed a police officer.

Image copyright AFP/ Getty Images Image caption Mr Ali tried to strike at the "heart of democracy" the Old Bailey heard

The court was told Mr Ali called for the West to leave Muslim lands, for Palestinian territories to be returned and for prisoners of war to be released.

The prosecutor said the defendant regarded himself as a "soldier of Islam, a holy warrior" and told police he was loyal to the Taliban and al-Qaeda.

The FBI found Mr Ali's fingerprints on components of bombs uncovered in 2012, the court heard.

Mr Altman said the defendant admitted to "detonating devices maybe more than 300 times, although he later backtracked on this."

Jurors were told that on April 22 he carried out reconnaissance of buildings in London including the Houses of Parliament and the MI6 building.

The trial continues.