Scotland Yard has arrested the man and he remains in police custody

An undercover operation was launched to try and track any similar plots

He was then sent back to Britain in a plot to launch an attack against MI5

An MI5 agent was allegedly recruited by a terrorist mastermind in Syria and sent back to Britain in a plot to launch a devastating attack against his handlers.

The agent was recruited by MI5 as an undercover informant within the radical Islamic community and he then travelled to Syria where he became part of a jihadist group.

But he apparently double-crossed his British handlers and returned to London with plans to launch an 'insider attack' in the capital.

The Mail on Sunday has been aware of the alleged plot for more than a year but agreed to previous requests from the security services not to publish the story for 'national security' reasons.

Parts of the plot were reported in a story in The Mail on Sunday last year, in which we revealed that the jihadist, who has a British passport, had plans to attack Central London and that David Cameron had been briefed about the details.

This newspaper is aware of the man's identity and further details of the investigation but are not printing them for legal reasons.

A long undercover operation was run by MI5 to try to identify linked individuals who might be travelling back from Syria to launch similar attacks but this investigation has now concluded, meaning we can now report the fact that he was a potential 'double agent'.

The revelations come as the terror threat in the UK continues to be 'severe' but as MI5 faces difficult questions about its tactic of recruiting agents who are known Islamic extremists.

Supporters of Mohammed Emwazi, the Islamic State executioner known as Jihadi John, have claimed that MI5 harassed him and similar allegations have been made by the family of Michael Adebolajo, one of the killers of Fusilier Lee Rigby.

The security services refuse to answer such questions because they stick by a strict policy to 'neither confirm nor deny' whether individuals have been approached or recruited – a policy they stick to even after suspects have been accused of serious crimes.

However, The Mail on Sunday can disclose that the man worked for MI5 for a period before he decided to travel abroad in 2012.

MI5 faces difficult questions about its tactic of recruiting agents who are known terrorists, while supporters of Mohammed Emwazi (pictured) have claimed that MI5 harassed him

Investigators believe he met a terrorist mastermind with designs on attacking the West who encouraged him to plan an attack.

Back in Britain, information suggested he began plotting to attack the MI5 handlers who had recruited him and set about trying to buy automatic weapons in this country or abroad. The alleged 'double agent' was apparently planning to use the firearms to stage a murderous attack on the public in an echo of the Kenyan shopping mall massacre last year, sources said.

He remained in contact with his jihadi controller, a terrorist mastermind who is thought to have established links to Britain.

The agent also joined up with another extremist and they approached two other men for help in obtaining the equipment, but these other men did not agree to help them.

MI5 were sufficiently concerned by an intercepted communication they received that they launched an emergency operation to apprehend the man. Scotland Yard's firearms unit was sent to Central London when investigations suggested he was close to launching his attack.

The man was detained for questioning and remains in custody. However, no firearms were discovered linking him to a plot and it appears the security services' fears of an imminent attack were unfounded.

There has been growing concern from within the security services that there could be 'blow-back' from the conflict in Syria, where hundreds of young Britons have joined the fighting.

Eleven months after the agent was allegedly planning his attack, police and MI5 rounded up another cell linked to IS also allegedly planning a gun attack in Central London. Five men are currently awaiting trial.

Some details of how MI5 go about recruitment have been released in recent months as part of an investigation by the parliamentary Intelligence and Security Committee. They often approach individuals they are investigating in order to try to recruit them as agents, known as Covert Human Intelligence Sources.

They then assess them on their suitability, their access to intelligence, personal qualities and their motivation for working with MI5.