ALEX Salmond's Government has been accused of manipulating the Ministerial Code to stonewall questions over an independent Scotland's place in the European Union.

The First Minister argued that he was unable to say whether he had received legal advice on Scotland's EU membership due to a gagging clause in the code.

However, the Sunday Herald can reveal the Government rewrote the key section of the code while the issue was being considered by Scotland's Freedom of Information (FoI) watchdog.

The EU status of an independent Scotland has become one of the biggest controversies of Salmond's leadership. The SNP insists Scotland would automatically be an EU member and avoid the euro, while critics say Scotland may have to apply for membership and adopt the euro.

In May last year, Labour MEP Catherine Stihler used FoI to ask the SNP Government if it had been given specific legal advice on the subject. Ministers refused to answer, and Stihler appealed to the Scottish Information Commissioner, Rosemary Agnew, last October.

After a nine-month investigation, Agnew ordered the Government to confirm if it had received any advice. Although she did not order any content to be released, Agnew said there was a "strong public interest" in establishing whether or not advice existed on such an important subject.

However, the Government refused and launched an appeal at the Court of Session to keep the matter secret. Ministers argued that the Scottish Ministerial Code, which governs the behaviour of Salmond and his colleagues, made it impossible to confirm or deny the existence of legal advice.

Salmond cited section 2.35, which reads: "The fact that legal advice has or has not been given to the Scottish Government by the Law Officers ... must not be revealed outwith the Scottish Government without the Law Officers' prior consent."

Salmond said answering Stihler's question would therefore breach the code.

However, this section of the code was rewritten in December, while Agnew was considering Stihler's appeal, in a way that appears to give ministers a second line of defence should they lose the FoI case.

The previous code, from 2008, said that ministers could not reveal if "legal advice has been given". This was extended to say if "legal advice has or has not been given".

The additional phrase "or has not been given" was later relied on by ministers to justify saying nothing on the subject.

Two weeks ago, after years of asserting that Scotland would automatically be in the EU, ministers finally admitted they had never had any specific advice from their own law officers to support the claims.

It led to accusations of a cover-up, with Labour calling Salmond a "barefaced liar".

The Government is now seeking advice from the Lord Advocate and Solicitor General for Scotland.

Stihler said: "So now we find out that Alex Salmond moved the goalposts to protect himself and hide the fact that he did not have legal advice after all.

"It makes a mockery of the Ministerial Code that the ministers who are covered by it can change it at their discretion and use it to hide behind."

The Sunday Herald can also reveal other changes to the code relevant to the EU.

The 2008 version stated it would "normally be appropriate" to seek the advice of the Government law officers in four areas, the first of which was when "the legal consequences of action by the Government might have important repercussions in the foreign, European Union or domestic fields".

This was diluted in the 2011 version to four "examples of the kind of situation" where advice from law officers should be sought. The first example was then shortened to "the legal consequences of action by the Government might have important repercussions". The reference to "foreign, European Union or domestic fields" was deleted.

The revelations raise questions about who should write and police the code.

The Scottish Government, in common with previous administrations, is responsible for amending the code for ministerial behaviour. The First Minister also decides whether complaints about him should be referred to an expert panel, and chooses its members himself.

Scottish Liberal Democrat leader Willie Rennie said: "Alex Salmond's emergency changes to his own Ministerial Code reveal the level of manipulation that enveloped his office following the receipt of the EU legal advice inquiry."

Labour MSP Lewis Macdonald, who called for an urgent review of the code, said: "It is now clear that the code is simply being manipulated by Alex Salmond to protect himself from the glare of transparency on how he runs his Government."

A spokesman for the Scottish Government said: "The Ministerial Code was tabled in Parliament in December 2011 following the election in the normal way. This happens after every election. These textual changes had no bearing whatsoever on the Stihler appeal."

He also said that the changes "had no impact at all" in the Information Commissioner's consideration of the Stihler appeal, and that the Government's appeal to the Court of Session concerned the "interpretation" of the FoI (Scotland) Act.

"There is no difference in meaning between the formulation 'has been given' and 'has or has not been given'."