The lack of preparation for Scottish independence in the rest of the UK is "astonishing", Britain's former most senior civil servant has said.

Former cabinet secretary Lord O'Donnell said heads were "stuck firmly in the sand" and called for more debate on the consequences of a Yes vote in next month's referendum.

Lord O'Donnell said the rest of the UK would be faced with "serious policy issues" in the event of independence, including the relocation of Trident, where to build military ships and how to distribute the UK's assets.

Writing in the Sunday Times, he said: "The departments of works and pensions and HMRC will have to find ways to unpick their computer systems to allow Scotland to have different policies.

"This will be a very expensive and lengthy task. It is astonishing that there has not been more debate about all these issues in England, Wales and Northern Ireland. Heads are stuck firmly in the sand."

Lord O'Donnell said the lack of preparation by the UK Government could lead to negotiations in the event of independence taking longer than the 18 months set out by the Scottish Government.

He said: "We all face not just a constitutional mess but a protracted period of uncertainty as various issues are thrashed out.

"The UK Government is as worried about being seen to prepare for a Yes vote as the Scottish Government is about making plans for a No vote.

"Those of us now outside government have a duty to provoke debate on this profound decision that will have enormous implications for everyone in the United Kingdom."

Lord O'Donnell said the "main problem" with the Scottish Government's preference for a formal currency union with the rest of the UK was political.

The three main parties at Westminster have repeatedly ruled out that option and have called on First Minister Alex Salmond to set out a plan B.

Lord O'Donnell said: "It is inconceivable that, whatever the complexion of the UK Government after the May 2015 election, the new parliament would vote to constrain itself in the necessary manner for the sake of a currency union with Scotland."

He also described the Scottish Government's threat to walk away from its share of UK national debt as "empty", adding that "a default would result in Scotland paying higher interest rates for many years".

He said he would advise an independent Scotland to adopt its own currency and let it float.

"This would have the advantages of an independent central bank to act as a lender of last resort to the banking system, and exchange rate flexibility to cushion the impact of positive or negative shocks," he said.

A UK Government spokesman said: "We and the Scottish Government have both explained that it is not possible to pre-negotiate the terms of independence before the referendum.

"The UK Government has no mandate to act on behalf of only one part of the UK and against the majority of Scottish voters who intend to vote no."

A Scottish Government spokeswoman said: "It is for the UK Government to comment on their own contingency plans post referendum however we have repeatedly stated that Scotland can complete the negotiations required following a vote for independence within the 18-month period we have outlined - in line with widespread international precedent and a timescale described by the UK Government's own legal adviser, Professor James Crawford, as 'realistic'.

"There would be a mutual interest on the part of both Scotland and the rest of the UK in engaging constructively in negotiations after the referendum, as set out in the Edinburgh Agreement."