A senior Nationalist has written to the head of the UK's Security Service and asked for an assurance that MI5 spies will not interfere in the independence referendum.

Margo MacDonald MSP, who says she believes there are undercover agents operating in the SNP, told MI5 chief Andrew Parker that his staff should only be used to thwart criminal and terrorist acts, rather than engage in dirty tricks against those who support Scottish independence.

A Home Office spokesman declined to comment on the letter.

The purpose of MI5 is to protect the UK "against threats to national security", a form of words that could be interpreted as resisting the break-up of Britain. Some Nationalists have long believed the SNP was infiltrated in the 1970s by agents worried booming North Sea oil revenues could lead to independence.

MacDonald, a former deputy leader of the SNP and now an independent MSP, believes MI5 was active during the constitutional debate in this period and wants a commitment that such activity has ceased.

In a letter to MI5's director general, MacDonald wrote: "I will be obliged if you can give me an assurance that UK Security Services will not be used in any respect in the lead-up to the Scottish referendum on sovereignty, unless, of course, the Scottish police have sufficient evidence to justify normal responses to potentially overtly criminal acts.

"I do understand that the Security Services are vital to all the countries and regions of the British Isles and the potential for law-breaking may be heightened during the forthcoming campaign.

"As action on the Security Services' part is calculated to keep communities safe and aid cohesion, I would welcome an assurance from you that this will continue, and that no other consideration will inform your Department's work."

Speaking to the Sunday Herald, MacDonald said the recent comments of former chancellor Denis Healey, who said the Labour Government of the 1970s had underplayed the value of oil revenues, underlined her concerns. She said: "The influence of the security services was insidious. If the opportunity came up to depress the self-confidence of Scots, then the opportunity was taken."

Asked if she believed the SNP and the wider Yes movement was currently infiltrated, she said: "Of course the security services have people in the SNP."

Crispin Black, a former intelligence adviser to ex-prime minister Tony Blair and the Joint Intelligence Committee, said he believed MI5 would monitor the independence debate: "My guess is that MI5 would have the referendum on its radar, primarily to ensure its fairness. There's definitely a national security angle to Scottish independence that the security services would be aware of, but my sense is that they would be stopping dirty tricks, rather than trying to initiate them."

He added that MI5 would have a concern about the knock-on effect of independence on Northern Ireland.

A spokesman for the Scottish Government declined to comment.

At the Home Office, which handles enquiries about the Security Service, a spokesperson said the department would not comment on private correspondence.