THE spin doctor to the former first minister, Henry McLeish, last night admitted that he had given the go-ahead to the politician's disastrous appearance on BBC television's Question Time programme.

The former special adviser, Peter MacMahon, is risking legal action by telling his story in contravention of the Civil Service rules by which he was bound.

He admitted last night that he had sanctioned the ill-fated appearance on Question Time which culminated with the anchor man, David Dimbleby asking how much rent he had taken over the years on his double-let office in Fife.

Mr MacMahon denied that it was wrong to put Mr McLeish on television at the height of the affair. ''He was an experienced politician who had been on Question Time before,'' he said.

He also confirmed that it was The Herald's inquiries about a further office sub-let, after he had come clean about previous deals, which prompted him to advise Mr McLeish that he had to go.

He defended Mr McLeish as ''a decent man'' who had done nothing dishonest. But he also shrugged off any suggestion that he had broken any rules by publicising his account of the affair in contravention of Civil Service rules.

There was no green light from Mr McLeish, he said, but he explained: ''I told him I was writing it and he did not say I shouldn't.''

Mr MacMahon, like all special advisers to ministers, signed a confidentiality deal when he took the job, and is bound by both the Official Secrets Act and the Civil Service code of conduct, and would have been reminded of these rules in his letter of termination when he left office. His decision to write a series of newspaper articles on the fall of Mr McLeish provoked anger across the political spectrum.

Last night, however, he said he was merely returning to his old trade of journalism and would not reveal sensitive issues.

The spokesman for Jack McConnell, the first minister, said last night: ''Peter MacMahon may have broken a rule. It is necessary to keep a sense of proportion and we don't proposed to speculate on our next steps.''

This could involve an interdict to block further articles, or an action for damages for breach of contract, although the reference to ''a sense of proportion'' indicated that the executive would be reluctant to add to the publicity.

David McLetchie, the Tory leader, said this could be ''yet another example of the tawdry behaviour and appalling standards of personal conduct that have come to typify the Labour party in Scotland today.'' The first minister's spokesman explained yesterday: ''All civil servants, including special advisers, are under a duty of confidentiality and must protect official information which is held in confidence.

''All former civil servants are bound by certain terms and conditions in relation to activities involving official information. Former civil servants are bound to seek permission and provide draft texts for clearance before publishing personal memoirs. Peter MacMahon has not sought permission.''

When Donald Dewar died, his official spokesman, David Whitton, made a conscious decision not to divulge any information that he had gleaned in the course of his job.

He did write articles expressing his personal grief at the first minister's death, and wrote columns commenting on current political affairs, but nothing that related to his time as a key aide to Mr Dewar.

Mr McMahon confirmed last night he had not sought clearance for the account.

''Before I worked for Henry McLeish I was a journalist, so I am going back to my old trade,'' he said. ''I think this is an interesting story which I am telling. I am very conscious of the responsibilities on official secrets that were imposed on me, and I would not do anything that I thought would jeopardise national security or reveal sensitive issues.