If Britain does end up with a hung Parliament, it will be for the first time since 1974, when the country had to wait uncertainly for several days to learn the identity of its new government.

In the February 28, 1974 election, the Conservatives under then premier Edward Heath won 297 seats against 301 for Labour, led by Harold Wilson. Both were still short of a majority of 318 in the then 635-member House of Commons.

As the incumbent Prime Minister, Heath - a bachelor known for his love of classical music and yachting - got first shot at forming a government.

Amid intense media and public interest, he hung on for four days after the election trying unsuccessfully to strike a deal with the Liberals, who had won 14 seats, and the Ulster Unionists.

Meanwhile, senior civil servants were working discreetly to ensure that the complex principles and conventions governing such situations - many of which are buried in musty old files or interpreted from precedents - were followed.

One of the most important discussions, between Queen Elizabeth II's private secretary and the top civil servant in charge of the Cabinet Office, took place during an afternoon stroll around London's St James's Park, according to Peter Hennessy, an authority on the history of government.

However, Heath's hopes for a deal hit the rocks and he had to call at Buckingham Palace to concede defeat.

In a secret document which has since been declassified, the premier's principal private secretary Robert Armstrong recalled the bleak mood in the car as he and Heath drove from Downing Street to the queen's London home.

"On the drive we neither of us said a word. There was so much, or nothing, left to say," Mr Armstrong wrote, recalling that he "nearly broke into tears" at the palace.

The Queen subsequently called in Wilson, the pipe-smoking Labour leader who had already spent six years as premier from 1964 to 1970, and was himself short of an overall majority.

Wilson formed a minority government which survived through to a second general election in October 1974 called to resolve the situation.

This second election resulted in a majority of just three seats for the government of Wilson, who subsequently resigned in 1976.

He was replaced by James Callaghan and Labour had to rely on a pact with the Liberals from 1977 to 1978 after a motion of no-confidence.

The weak Labour government was eventually ousted by the Conservatives, led by Margaret Thatcher, in 1979.

The magic number of seats the parties have to aim for to avoid having to seek a deal, is 326 - one more than half of the 650 members in the newly-elected lower house of Parliament.

Sign up to our free newsletters

Get the best updates straight to your inbox:
Please select at least one mailing list.

You can unsubscribe at any time by clicking the link in the footer of our emails. We use Mailchimp as our marketing platform. By subscribing, you acknowledge that your information will be transferred to Mailchimp for processing.