Donald Trump, famously, has never held elected office. At times on the campaign trail, the prospective US president’s grasp of how government works has seemed less than firm. But the republican candidate does have experience of appearing before parliament – four years ago, when he ended up formally accusing the leader of the Scottish Green Party of blasphemy.

Trump has long been a vocal opponent of wind farms in Scotland, claiming that the sight of the turbines would do “tremendous damage” to tourism, including his multi-million-pound Aberdeen golf development. So when the Scottish parliament established a committee looking at the impact of renewable technology, the controversial businessman was invited as a witness.

“Somewhat to our astonishment he came,” recalls Murdo Fraser, the Conservative convenor of the economy, energy and tourism committee.

Trump had once been close to the Scottish government. In 2008, the Scottish National Party (SNP) administration stepped in to ensure the golf development went ahead after Aberdeenshire Council had rejected r planning permission.

By April 2012, however, Trump was a deeply divisive figure in his mother’s native land. When he arrived to give evidence, the scene outside the normally sedate Holyrood parliament resembled a fiery political rally. Crowds of placard-wielding anti-wind farm activists chanted “there’s only one Donald Trump”. Environmentalists booed loudly. The reality TV star smirked and waved.

Inside the parliament the scenes were equally chaotic. One of Trump’s bodyguards triggered a security scare when a suspicious canister was spotted strapped to his hip. It turned out to be hairspray.

Once proceedings finally began in the small, wood-panelled committee room, Trump displayed an approach to argument that would be familiar to any viewers of the recent presidential debates: the Scottish landscape was, he said, being destroyed by subsidy-draining, inefficient and Chinese-built wind farms.

“As a piece of political theatre it was tremendous,” says Murdo Fraser. “But in terms of his evidence there wasn’t much to it, there wasn’t much substance.”

Absurd to ridiculous

The Scottish public, Trump continued, loathed wind farms. When Scottish nationalist Chic Brodie asked what evidence Trump had to support his claims, the billionaire pointed at himself and declared “I am the evidence”.

“It was the biggest laugh of the morning,” recalls Patrick Harvie, co-convener of the Scottish Green Party. “He thought people were laughing because he had said something terribly clever but they were laughing because what he had said was absurd.”

For Harvie, Trump’s appearance quickly went from absurd to ridiculous.

After The Apprentice anchor had finished his almost two-hour evidence session, Harvie tweeted an image from Monty Python’s Life of Brian. Superimposed beside each character was a speech bubble that read “I am the evidence”. George Sorial, Trump’s combative right-hand man, complained to the Holyrood standards commissioner that the Scottish Green politician had been “offensive” and “blasphemous”.

The Scottish blasphemy law was last enforced in 1843 but, under parliament rules, an investigation had to be launched. Harvie, a slight, bespectacled man with a mild manner that masks a black sense of humour, did not take the inquiry entirely seriously.

“I had to put in a submission in response. I used lots of other Monty Python references in it. ‘I didn’t expect the Spanish inquisition.’ It was nonsense,” says Harvie. The case was dismissed, making Harvie the only Scottish parliamentarian ever to be formally cleared of blasphemy.

Trump’s buffoonish turn at Holyrood – more than one person present describes the day as “a circus” – masks deeper, more unsettling questions about the relationship between the property developer and the Scottish establishment.

In recent years, every major Scottish political figure has been at pains to distance themselves from Trump. Earlier this month, Nicola Sturgeon said she would be “horrified” if Trump became president. Last year, the Scottish first minister rescinded his membership of the GlobalScot business network after Trump called for a ban on Muslim immigration.

But a decade ago, the situation was very different. Labour Scottish first minister Jack McConnell and his Scottish National Party successor, Alex Salmond, both aggressively courted Trump, whose mother hails from the island of Lewis in the Western Isles.

After much encouragement, Trump purchased the Menie estate just north of Aberdeen in 2006. The 600-hectare estate sat upon a legally protected dunes system, designated as a site of special scientific interest under the UK’s environment laws.

Planning approved

When Aberdeenshire Council rejected Trump’s proposal to build a sprawling golfing complex on the site – in large part due to a warning from Scottish Natural Heritage about the impact of the development – the minority Scottish National Party administration in Edinburgh intervened, in 2008. For the first, and so far only, time since devolution in 1999, the Scottish government overturned a rejected planning application.

“That’s the real tragedy of this. Trump just said ‘give me what I want or I walk away’,” says Patrick Harvie. “This was a misuse of the planning system. It was bought and sold.”

Eight years after winning approval for a resort that he claimed would employee thousands, Trump employs only 95 people there, many of whom are seasonal or part-time. Instead of the promised £1 billion-development, he has invested about only £30 million.

In 2015, Trump lost a bid to prevent the construction of 11 wind turbines off the coast of the golf course. In a parallel of his recent comments about the US election, he vowed to continue his challenge in the courts.