AS Donald Dewar and his officials were drawing up government plans for Scottish devolution, senior bureaucrats were warning of the dangers of continuing to have civil servants north of the Border being controlled by London.

The mandarins were also concerned that the new parliament would leave the Scottish Secretary of State with too little to do.

The revelations are contained in previously classified government files that shed an unprecedented light on Labour's devolution policy.

The documents from the early days of Tony Blair's administration, now available at the National Records of Scotland (NRO), reveal concern about civil servants working for the devolved administration while ultimately being "loyal" to authority outside Scotland.

The SNP Government's decision to release historical files after 15 years, rather than 30, meant that in January dozens of sensitive files covering Labour's 1997 devolution policy should have been released.

However, many are yet to be published after the Scotland Office insisted at the eleventh hour that the documents would have to be inspected prior to release.

After Labour's landslide win in 1997, Dewar was appointed Scottish Secretary and worked closely with ministerial colleagues to write a devolution White Paper to be put to the people in a referendum.

Dewar, who later died in office as First Minister, fought to ensure the Scottish Parliament controlled domestic issues such as health, education, justice and economic development.

But he decided the civil servants responsible for the devolved settlement would continue to be part of the UK-wide "unified" service, thus making their power reserved to Westminster.

In one file, a civil servant in the Cabinet Office questioned this arrangement: "Is it realistic to expect to maintain a unified Civil Service when its members will owe their ultimate loyalties to two different sets of ministers, not bound by collective responsibility and who may be of diametrically opposed political persuasions?"

A senior official in the old Scottish Office also suggested that Dewar, despite agreeing to a UK-wide system, sensed the political danger of maintaining the status quo: "My informal understanding was that the Secretary of State did wonder whether he could presentationally defend accepting the Scottish Executive as part of the UK civil service with the implication that perhaps ultimate loyalty lay outside Scotland not least because some senior appointments might be 'decided' outside Scotland."

The same mandarin argued that it "might be cleaner" to have a "separate Scottish civil service", but noted this might "give more of a flavour of separation than ministers would desire". He added: "My heart tells me this should be devolved since, after all, that is what the whole exercise is about."

The files also reveal that civil servants saw a bleak future for the role of Scottish Secretary in the UK Government after devolution.

In an options paper, a mandarin noted: "The case for retaining a separate Secretary of State, in terms of the range of responsibilities and workload, is clearest in Northern Ireland and weakest in Scotland."

The paper claimed that retaining stand-along secretaries of state could be a "transitional" position: "Once Scottish devolution has bedded down, however, a separate Secretary of State post could prove to have so little real content, that it would not be attractive to a Minister of ability and standing."

One solution considered was combining the posts of Scottish Secretary and Advocate General. However, officials were not convinced a suitable individual existed for the dual role, with one civil servant noting: "Good politicians are not likely to be good lawyers."

Fourteen years after the first Holyrood election, the Scottish Secretary post still exists. Michael Moore, a Liberal Democrat MP, is currently in the job.

The devolution discussions also touched on the issue of abortion, which at one stage was considered suitable to be devolved. Files from May 1997 make clear that Dewar was relaxed about the issue falling within the Parliament's remit.

However, newspaper reports from the time claimed Blair was sceptical of devolving control of abortion and the area remained reserved.

An NRO file from 1997 that deals with the abortion issue is marked as being closed for 30 years.

SNP MSP Jamie Hepburn said: "These papers show that when it comes to the crunch, Westminster will cling on to the power Scotland needs, even when they know that it is far better for the Scottish Parliament to have full responsibility."

A Scotland Office spokesman said: "These papers date back 16 years before any practical experience of devolution at work in Scotland and are entirely speculative.

"Recent history proves the post of Secretary of State for Scotland has never been more important, having delivered the Scotland Act 2012 and played a key part in referendum negotiations as well as being a strong voice for Scotland in Westminster."