Whoever ends up becoming United Kingdom’s new prime minister faces a daunting five years in office, with the negotiations of the country's withdrawal from the European Union topping the list of priorities.

Here are the five main challenges ahead:

Brexit

The Brexit negotiations are set to start around June 19, with Britain set to leave the bloc by the end of March 2019.

First up will be the status of EU nationals resident in Britain, and of British citizens living elsewhere in the bloc. Both Labour and the Conservatives have said freedom of movement will end when Britain leaves the EU.

If no party wins an overall majority as indicated in Thursday's exit poll, there will be little time to form a new government and get a negotiating stance up and running.

Parliament meets on June 13 to swear in MPs. The state opening of parliament by Queen Elizabeth II is set for June 19, when she will read out her new government's programme.

Prime Minister Theresa May called the election in order to strengthen her majority in parliament to go into the Brexit talks with a more secure hand.

Terrorism and security

The election was meant to be about Brexit but deadly terror attacks in Manchester, where 22 people were killed in a suicide bombing, and London, when eight were killed in a van and knife rampage, changed the debate.

London was the third Islamist terror attack in three months, also following an attack on Westminster Bridge. Eighteen terror plots have been foiled since 2013 — five of them since March.

Ms. May has come under pressure during the campaign for cutting thousands of police jobs during her time as interior minister. There were further questions when it emerged some of the attackers were known to security services and apparently escaped the surveillance net.

Tackling the problem of radicalisation among British Muslims and jihadists returning home from Syria will likely be a recurring theme for the incoming government.

Economy

Britain ran a budget deficit of 2.6 per cent of gross domestic product in March 2017, down from 9.9 per cent in 2010 after the financial crash. Its total public debt was £1.7 trillion in April, or 86.0 per cent of gross domestic product (GDP). Growth stands at 1.8 per cent and inflation at 2.6 per cent.

Leaving the EU single market would give Britain the opportunity to strike its own trade deals outside the bloc. The Conservatives pledged to eliminate the deficit and return Britain to profit by the "middle of the next decade", meaning further years of austerity.

Labour pledged to end austerity, hike corporation tax, raise taxes for the top five percent of earners, and eliminate the deficit within five years. The pound plunged on the exit poll predicting a hung parliament.

Scotland

Scotland's governing Nationalists are pushing for a second independence referendum once the terms of the final Brexit deal start to become clear in late 2018 or early 2019. Backed up by the Greens, the separatists have the Scottish parliament's support to ask the British government for the formal powers to start the process.

Ms. May fended off their push saying now was not the time, so soon after the 2014 referendum, when 55 per cent backed keeping Scotland in the United Kingdom. If Labour required the backing of the Scottish Nationalists to form a government, it would likely come at the price of another referendum.

Northern Ireland

One of the most delicate parts of the Brexit negotiations will be the place of Northern Ireland within the UK, and relations with the Republic of Ireland, which will be the kingdom's only land border with the EU. The likelihood of the UK being out of the EU single market, customs union and the EU's free movement area could mean a return of a "hard border" which is fiercely opposed by local residents.

The 1998 accords that maintain the peace in the province after three decades of inter-community bloodshed are delicate and there is concern that Brexit could upset stability. There is currently no sign that a majority in Northern Ireland, where pro-British Protestants remain the largest group, want to merge into the republic.

But Irish nationalists Sinn Fein have called for a referendum on reunification within the next five years.