Cabinet secretary Sir Jeremy Heywood has urged civil servants to act with "calm, integrity and commitment", after Britain's vote to leave the European Union marked the start of a protracted period of upheaval which is likely to dominate life in Whitehall for years to come.
After the British people voted 52-48% in favour of quitting the EU, prime minister David Cameron on Friday morning confirmed his intention to step down in time for the Conservative party conference in October, and vowed to do "everything" possible to "steady the ship over the coming weeks and months".
Writing to civil servants after Cameron's emotional statement on the doorstep of Number 10, Heywood told officials that their duty to serve was now "clear".
David Cameron announces resignation as Britain votes to leave the European Union
EU referendum: your step-by-step guide to how Brexit would play out
"The task falls to us to support the government, and the new prime minister when appointed, in carrying forward the clear decision of the British people to leave the European Union and set a new direction for the country," Heywood wrote, in an internal message passed to CSW.
He added: "I am confident that we will do this with our customary calm, integrity and commitment. And we will do so while ensuring other business continues as usual, serving the public with professionalism and pride."
"Any controversial decisions will be put off for the new prime minister, and his or her new Cabinet" – Julian McCrae, Institute for Government
The civil service is undoubtedly used to handling political transitions – but a number of Whitehall-watchers have already pointed out that the challenge of untangling the UK from the European Union is of a different order of magnitude to the usual general election handover.
Julian McCrae, deputy director of the Institute for Government think tank, said uncertainty over the make up of the next government meant major domestic business in Whitehall was now likely to grind to a halt as the country awaits new leadership.
"The PM will remain in place and for uncontroversial issues, the cabinet nature of our government will come to the fore, with some progress being possible by consensus," said McCrae.
"But any controversial decisions will be put off for the new prime minister, and his or her new Cabinet. This will cause difficulties, as a large backlog has built up in Whitehall over the referendum campaign.
"There is certainly no chance of a decision on issues like the expansion of airport capacity in the southeast (a decision that has been put off repeatedly for decades). However, the financial and performance pressures in services like the NHS may be more difficult to ignore."
"Great big unknown"
In spite of Thursday's night of high drama, the UK does not suddenly find itself outside of the EU following the vote.
Formal withdrawal talks are only triggered when Britain invokes Article 50 of the Lisbon Treaty, which puts other European Union leaders on notice that the UK intends to quit the bloc – and Cameron has said he will not immediately make use of the clause.
That would, said Dr Stephen Barber, a public policy expert from London's South Bank University, give officials "a bit of breathing space" before any major changes have to be made.
"This is going to take a very long time and consume a lot of the energies of Whitehall and Westminster" – Former FCO perm sec Sir Simon Fraser
But he pointed out that the referendum question does not make clear what kind of arrangement the UK will push for once it leaves – leaving the civil service, and the country, facing a "great big unknown" that will only be resolved by clear political direction.
"As the prime minister pointed out, absolutely nothing changes yet," he told CSW. "We haven't yet triggered Article 50. All the trade deals are still in place. Free movement stays in place. So we've got a bit of breathing space – but the future's very, very uncertain."
Dr Alan Renwick, deputy director of University College London's Constitution Unit, said Cameron's decision to seek a pause before triggering Article 50 was "very sensible".
"I don't think we should expect other member states to be willing to enter substantive negotiations before Article 50 is triggered," he told CSW. "But it is necessary, clearly, for the UK to work out its own position and how it's going to advance that.
"And it'll be necessary for other member states as well to work out their positions – just to think through this thing that has landed upon them."
Whatever type of deal the new prime minister sets his sights on, the UK is unlikely to "get a deal which gives us the same level of access to the European market as we have now", according to Sir Simon Fraser, former permanent secretary of the Foreign and Commonwealth Office, who set out the scale of the challenge now facing his former colleagues.
"There’s another negotiation to be had with the other countries of the world about the terms of our trade," he told the BBC. "And on top of all that we have to go through the whole body of our law and regulation so the government can decide what it wants to keep and what it wants to change, and how it’s going to change it.
"That is a massive set of tasks which is going to take a very long time and consume a lot of the energies of Whitehall and Westminster," he said.
"It may be possible to import some expertise back from the European Commission"
Several experts have already raised questions over Whitehall's capacity to strike trade deals, however – something which the UK's membership of the EU means it has not had to do for decades.
The Foreign Affairs Committee last month said Brexit would require "swift action" by the FCO, and a "vigorous response would require resources and a decision to double, or even treble" the budget for the Foreign Office.
Renwick agreed that a boost to the UK's diplomatic capacity would now be "urgently" required in the wake of the vote to Leave.
"Presumably there are some Brits who can be brought over from the European Commission," he said. "It may be possible to import some expertise back from there. But that's certainly not going to be enough, remotely, to do the job."
Few departments are likely to be left untouched by the Brexit process – and there has been some speculation that a new "super-ministry" for Brexit issues could be established, or that the centre of government's European and Global Issues Secretariat (EGIS) could be in line for a boost.
While nobody CSW spoke to on Friday wished to speculate on the precise departmental structures that the vote might require, Barber said he believed the Treasury, rather than the Foreign Office, would be best placed to lead negotiations – perhaps led by a minister with specific responsibility for making withdrawal work. The Leave campaign has already been pushing for justice secretary and prominent Brexit campaigner Michael Gove to take on such a role.
As well as overseeing the detailed work of renegotiation and implementing major policy changes prompted by cutting ties with the EU, civil service leaders may also find themselves having to work hard to convince key Leave campaign figures that they are capable of serving the new administration after a bitter campaign.
"The civil service is based on the notion that it is there to serve any government – you don’t rise to senior positions within it unless you are prepared to do that," said McCrae.
"There is no doubt that the civil service will support the new prime minister and their cabinet as fully as they have supported the incumbents.
"But that does not mean things will be easy. Many of those on the Leave side have expressed suspicions about the role that the civil service has played.
"Whoever leads the government will need to ensure that they provide the civil service with the resources and expertise necessary to deliver this outcome" – FDA general secretary Dave Penman
"The civil service needs to start now in building up the skills it needs for the negotiations ahead. It will, quietly, make sure it has people in place who will have the trust of the government as it moves forward. And it will think carefully about the structures it needs to put in place to allow the negotiations to work."
Dave Penman, general secretary of the FDA union for senior civil servants, said the period of uncertainty now facing the UK showed the value of a "permanent and politically neutral civil service" – and called for incoming ministers to make sure the organisation had "both the capacity and capability" to meet the challenge ahead.
"As we now begin to consider the process of removing the UK from EU decisions and structures, the government of the day will be faced with determining what will replace them and how this will be implemented," he said.
"Whether it’s negotiating new trade deals with the world, implementing a new immigration policy, creating a new system of farm subsidies or sustaining regional development, the civil service will be tasked with delivering the vision for Britain that will follow this result.
Penman added: "All sides in this debate recognise that negotiating an exit from the EU will be a complex process, taking a significant amount of both time and resource. Whoever leads the government will need to ensure that they provide the civil service with the resources and expertise necessary to deliver this outcome."
Britain's decision to leave the EU will undoubtedly have taken many in Whitehall by surprise – indeed, one former senior official told CSW last month that a vote to leave would come as a "real shock" to his former colleagues.
But Renwick said civil servants were now likely to do "what civil servants do best – accept the job and make the most of it. That's the only thing that can done."