Civil servants will for the first time help Britain's political parties to stitch together a post-election agreement if the general election results in a hung parliament.
Whitehall officials will analyse the parties' policies to look for common ground between them that could pave the way for a coalition or understanding in which a minority government was supported in Commons votes by another party. Officials could also act as "facilitators" in talks between different opposition parties – including those that came second and third in the election.
Gordon Brown has given the go-ahead to the involvement of civil servants in such talks if no party wins an overall majority. With recent opinion polls pointing to such a result, Sir Gus O'Donnell, the Cabinet Secretary, is rewriting the Whitehall manual, which will be published shortly. It will make clear that politically neutral officials would not take part directly in the negotiations between politicians.
The "cabinet manual" will reiterate that the monarch should remain above party politics. However, the Queen could refuse a prime minister's request for an early second election in the national interest.
Under the guidance, Mr Brown would remain Prime Minister until he decided to resign – even if the Conservative Party secured more MPs than Labour. This convention allowed the Tory prime minister Sir Edward Heath to hang on in office over a weekend as he tried to form a coalition with the Liberal Party even though his party won fewer seats than Labour.
The same rule means that Alistair Darling could remain briefly as Chancellor – and even handle a post-election run on the pound – even if he lost his Edinburgh South west seat, where he had a 7,242 majority over the Tories in 2005.
A change in Commons rules means that there could be a longer period – up to 18 days – between the election and Parliament sitting. This would allow time for horse-trading between the parties if the election ends in a stalemate.