A future SNP council boss was denounced as a union "militant" in the 1980s by Scotland's top civil servant, according to files from the National Records of Scotland.

Steve Cardownie, now deputy leader of Edinburgh City Council, was the subject of acid criticism in a newly released 
confidential memo written by Sir William Kerr Fraser, then permanent secretary at the Scottish Office.

As chairman of the Civil and Public Servants Association, Cardownie met Fraser to discuss the impact of Margaret 
Thatcher's Tory government banning unions from GCHQ, the security service eavesdropping centre in Cheltenham.

Ministers said the move was to protect key services, but it provoked protests from unions fearing similar bans elsewhere.

In January 1984, two days after the ban was announced, Cardownie and six other union leaders took their grievance to Fraser. The official note said Cardownie rejected the "offensive" inference that union membership threatened national security, claimed it was part of a government effort to break the trade union movement, and raised the possibility of strike action.

Four days later, Fraser wrote a memo marked "confidential" to the then Scottish Secretary, Sir George Younger.

Fraser said two "principal spokesmen for the unions delivered largely political harangues". One was Cardownie. Fraser was reluctant for Younger to face Cardownie, but warned refusal to meet unions could spark a strike.

He said union militants in the Scottish Office had found it hard to find issues to justify industrial action.

"Suddenly they have been presented with an issue which they may well be able to exploit for this purpose," he wrote. "A refusal to meet them would provide the militants with another goad with which to prod their members."

Younger met the unions 10 days later, and Cardownie again refused to accept assurances that the ban would be limited to GCHQ.

Cardownie became a Labour councillor in 1988 before joining the SNP in 2005.

He admitted he had been "abrasive" with the mandarin.

He said: "I was robust in defending the membership. I had a mandate to be militant."

However he stressed he had not been in the far-left Militant Tendency group in Labour, and that he and Younger later got on well.