IT started out as whispers between lawyers over boozy lunches and mutterings of discontent in police canteens.
A group of gay judges and lawyers were conspiring to ensure soft treatment for homosexual criminals, or so went the rumour that spread through Edinburgh legal circles in the late 1980s.
The talk was of a “magic circle” reaching the highest levels of the Scottish legal system and the potential blackmail of judges by “rent boys”.
The gossip grew on the back of police frustration at the outcome of a series of fraud and other cases, where officers felt that defendants who happened to be gay had been unusually leniently treated.
It would all no doubt have died a quiet death if it were not for the bizarre events which took place one Sunday night at what was then the Lothian and Borders the police headquarters at Fettes.
At around midnight on 19 July 1992, an intruder slipped in through an open window – which was apparently left unlatched by detectives who used it as a shortcut to the car park – and made his way to the offices of the Serious Crime Squad.
Daubing Animal Liberation Front slogans on the walls as a smokescreen, he spent two hours searching the offices, including that of Deputy Commander Jimmy Smith, before making off with a haul of confidential files.
Among the two holdalls full of missing documents were ones listing details of police informants, Loyalist sympathisers and Animal Liberation Front activists.
But there was one particular police report which would cause huge embarrassment to the force.
It examined the alleged existence of the so-called “magic circle” within the highest echelons of the Scottish judiciary.
Written by a respected senior detective, Detective Inspector Roger Orr, it concluded there was evidence to support claims that justice was being seriously subverted by “a well-established circle of homosexuals”, including judges, sheriffs and lawyers.
Significantly, the report named names.
The police dossier listed five court cases where the outcome caused concern among officers and lawyers and concluded that “homosexuality may well have been used as a means to seriously interfere with the administration of justice”.
Now there was panic at police headquarters.
The possibilities – including a potential goldmine for blackmailers and the undermining of public faith in the judicial system – did not bear thinking about.
Derek Donaldson, 32, a convicted fraudster and valued police informant, was quickly identified as the prime suspect.
Frantic efforts were made to recover the documents – attempts that would lead to the downfall of some of Lothian’s top detectives.
One former senior detective, who was serving on the force at the time, recalls: “This was a perfect example of a storm in a teacup. You had a very dangerous and Machiavellian informant who had been allowed to gain a position of influence and power because he was good at what he did. But he was a double-dyed manipulator.
“Then we had some very ill-advised junior detectives who had allowed themselves to be convinced that there was some sort of conspiracy. But they failed to follow the evidence.
“Whether there was any conspiracy, I can’t answer. What I can answer is that there was no evidence of it.”
Two detectives, Det Chief Supt William Hiddleston and Det Sgt Peter Brown, eventually promised Donaldson immunity from prosecution as long as the documents were returned.
Within weeks, the files had been dumped at the council tip off Dalkeith Road and police informed, but detectives naturally suspected the most sensitive documents had been copied.
The deal did not prove popular with the high command, however, who were anxious to see an arrest to act as a deterrent.
When he heard of it, Chief Constable Sir William Sutherland immediately vetoed the immunity arrangement.
The force was under immense scrutiny. The internal report and its controversial initial conclusion was leaked to the Evening News, sparking a national sensation.
The Crown Office appointed a highly-regarded QC, William Nimmo Smith, and a regional procurator fiscal, James Friel, to investigate.
But the affair, dubbed “Fettesgate”, was about to take another twist. Before the report was officially published, Nimmo Smith was duped into revealing his findings to a bogus journalist.
The “journalist” was none other than Derek Donaldson, who immediately sold his “scoop” to a tabloid newspaper, indicating that the report had found no evidence of a homosexual conspiracy.
Days later, Nimmo Smith was admitted to hospital with nervous exhaustion.
Donaldson was later jailed for assaulting a real journalist who had continued to investigate the events.
When Nimmo Smith’s report was finally published in January 1993, it dismissed the idea of a “magic circle” of gay lawyers.
The 101-page report concluded there was no evidence to support the idea of a conspiracy to undermine justice, but strongly criticised a number of police officers.
Some had been “prepared to give as much credence to rumour as to actual evidence and to believe in conspiracy theories whether or not supported by evidence”, it said.
Other officers, it suggested, had been motivated by homophobia.
William Hiddleston announced his retirement just hours after the chief constable had admitted a small group of detectives “may have let the side down”.
Several other officers connected were moved to uniformed duties.
Former long-serving Linlithgow MP Tam Dalyell played a crucial role in bringing the “magic circle” controversy into the public domain.
The stolen police report which sparked the scandal was prepared in response to a letter the MP wrote to then Lothian and Borders Chief Constable Sir William Sutherland.
Mr Dalyell had raised what he believed to be genuine public concern about a series of Crown Office decisions on cases investigated by the force.
Sir William took these concerns very seriously and, after discussions with his deputy, Hector Clark, decided to have a secret report drawn up by a senior officer.
The furore had positive effects on the force.
Lothian and Borders Police established formal links with a series of gay community groups for the first time in its history in the wake of the controversy.