Police feared a man with links to the Islamic State was about to launch an attack at the Edinburgh Tattoo, it has been claimed.
According to The Sun newspaper, Muslim convert Gavin Rae, 37, was spotted by police in a crowd of tourists on Princes Street.
Intelligence revealed he had been trying to buy a haul of firearms from an undercover cop he met in Edinburgh, according to the paper.
He was kept under surveillance by police officers while he visited the city.
The Tattoo alert was part of the case made against the extremist, now made public for the first time.
A source said: “Edinburgh was absolutely heaving because of the festival. A terror attack had the potential for devastating consequences. Rae went down to Princes Street and mixed with crowds from the Tattoo. There was genuine fear he could be about to launch an attack.
“Officers were on high alert but thankfully he ended up wandering about then going back to where he was staying.”
Rae was jailed for 18 years at the Old Bailey last July, where jurors heard he was turned back three times en route to join I.S in Syria.