A Brexit deal has been agreed between Boris Johnson's Government and the European Union.
Now remains the potentially very tricky task of convincing Parliament to approve it.
But how did we end up here?
From the moment David Cameron promised a referendum, through tense negotiations, many resignations, and a controversial prorogation, here is a timeline of the key moments in the process of the UK’s exit from the European Union so far.
January 23 2013
Under intense pressure from many of his own MPs and with the rise of Ukip, Prime Minister David Cameron promises an in-out referendum on EU membership if the Conservatives win the 2015 general election. Mr Cameron pledges to campaign with “all my heart and soul” for Britain to vote to Remain in the referendum, which he said would be by the end of 2017.
May 7 2015
The Tories unexpectedly make sweeping gains over Ed Miliband’s Labour Party and secure a majority in the Commons. Mr Cameron vows to deliver his manifesto pledge for an EU referendum.
June 23 2016
The UK votes to leave the EU in a shock result that saw 52% of the public support Brexit in a humiliating defeat for the Prime Minister. Mr Cameron quickly resigns, saying: “I don’t think it would be right for me to try to be the captain that steers our country to its next destination.”
July 13 2016
Theresa May takes over as Prime Minister after a bitter selection battle in which she triumphed over rivals including Boris Johnson, Michael Gove and Andrea Leadsom. Mrs May, who had backed Remain, promises to “rise to the challenge” of negotiating the UK’s exit.
November 10 2016
The High Court rules against the Government and says Parliament must hold a vote to trigger Article 50, the mechanism that begins the exit from the EU. Mrs May says the ruling would not stop her from invoking the legislation by April 2017.
March 29 2017
Mrs May triggers Article 50 of the Treaty on European Union. European Council president Donald Tusk said that the triggering of Article 50 was not a happy occasion, telling a Brussels press conference his message to the UK was: “We already miss you. Thank you and goodbye.”
April 18 2017
Mrs May announces a snap general election to be held on June 8. Justifying the decision, she said: “The country is coming together but Westminster is not.” The Prime Minister said “division in Westminster will risk our ability to make a success of Brexit”.
June 8 and June 9 2017
A general election takes place in the UK, which results in a hung parliament. Mrs May becomes head of a minority Conservative government – propped up by the Democratic Unionists – after her general election gamble backfired disastrously.
September 22 2017
In a crucial Brexit speech in Florence, Mrs May sends a message to EU leaders by saying: “We want to be your strongest friend and partner as the EU and UK thrive side by side.” She said she was proposing an “implementation period” of “around two years” after Brexit when existing market access arrangements will apply.
December 8 2017
The European Commission announces it is recommending to the European Council that “sufficient progress” has been made in the first phase of Brexit talks.
European Commission President Jean-Claude Juncker tells a press conference in Brussels that negotiations had been “difficult” for the EU and the UK. The announcement came after Mrs May and Brexit Secretary David Davis made an early-hours journey to Brussels.
Mrs May said the Brexit deal was a “significant improvement” which had required give and take on both sides, and said it would ensure “no hard border” in Ireland.
March 19 2018
The EU’s chief Brexit negotiator Michel Barnier says that he and Mr Davis have made a “decisive step” towards agreeing a joint legal text on the UK’s EU withdrawal.
He said there were still outstanding issues relating to the Irish border, saying: “We are not at the end of the road and there is a lot of work still to be done.”
March 23 2018
Leaders of the 27 remaining EU states approve negotiating guidelines for talks on Britain’s future trade and security relations with its European neighbours following Brexit.
The move sets the scene for talks on trade to get under way in earnest, following months of wrangling over the terms of the UK’s withdrawal in March 2019 and a 21-month transition period to the new arrangements.
June 19 2018
Britain and the European Union publish a joint statement outlining the progress that has been made since negotiations in March. Brussels warns that serious differences remain over how to deal with the border between Northern Ireland and the Republic after Brexit.
July 6 2018
Brexit plans are thrashed out by ministers at Chequers. Among them is the creation of a new UK-European Union free trade area for goods.
Going into Chequers the Cabinet was split, with Brexit Secretary David Davis understood to have major reservations about both the plan and whether Brussels would even consider it seriously.
But it is understood that all members of the Cabinet have signed up to the proposals and none of them have decided to quit rather than back the plan.
July 8 and July 9 2018
Brexit Secretary David Davis resigns from the Government. In his resignation letter he tells Mrs May “the current trend of policy and tactics” is making it “look less and less likely” that the UK will leave the customs union and single market.
He said he is “unpersuaded” that the Government’s negotiating approach “will not just lead to further demands for concessions” from Brussels. Mr Davis is replaced by Dominic Raab.
November 14 2018
In a statement outside 10 Downing Street after a five-hour Cabinet meeting, Mrs May said that Cabinet has agreed the draft Brexit withdrawal agreement.
She said she believed the draft agreement was “the best that could be negotiated”. She said: “I firmly believe, with my head and my heart that this is a decision which is in the best interests of the United Kingdom.”
November 15 2018
Mr Raab resigns as Brexit Secretary, saying he “cannot in good conscience support the terms proposed for our deal with the EU”. More resignations follow, including Work and Pensions Secretary Esther McVey.
Leading Brexiteer Jacob Rees-Mogg has submits a letter of no confidence in Mrs May.
November 16 2018
Stephen Barclay is promoted to Brexit Secretary from a ministerial role in the Department for Health.
November 25 2018
The 27 European Union leaders endorse the Brexit deal. Mrs May says MPs will have to decide whether to back the Brexit deal and “move forward together into a brighter future” or reject it and “open the door to yet more division and uncertainty”.
December 12 2018
Mrs May survives an attempt by Tory MPs to oust her with a vote of no confidence. Tory MPs voted by 200 to 117 in the secret ballot in Westminster.
Mrs May accepted that a “significant” number of Tory MPs had voted against her but said she now wanted to “get on with the job”.
She said she had a “renewed mission – delivering the Brexit people voted for, bringing the country back together and building a country that really works for everyone”.
January 15 2019
MPs reject Mrs May’s Brexit plans by an emphatic 432 votes to 202 in a historic vote which throws the future of her administration and the nature of the UK’s EU withdrawal into doubt.
The humiliating rebuff was delivered in the House of Commons just moments after she made a last-ditch appeal for MPs to back the Withdrawal Agreement which she sealed with Brussels in November after almost two years of negotiation.
January 16 2019
The EU’s chief Brexit negotiator Michel Barnier has said Brussels “profoundly regrets” the Commons vote on Mrs May’s Withdrawal Agreement after two years of negotiation “based on the red lines of the British Government”.
Meanwhile, Mrs May survives an attempt to oust her as Prime Minister, as MPs reject Labour leader Jeremy Corbyn’s motion of no confidence in the Government by a margin of 325 to 306.
February 14 2019
Mrs May suffers another humiliating Commons defeat after MPs again vote down her latest Brexit plans. MPs voted by 303 to 258 – a majority of 45 – against the motion endorsing the Government’s negotiating strategy.
March 12 2019
MPs reject the Government’s Brexit deal by 391 votes to 242. Although the 149 margin was reduced from the record 230-vote defeat of the first “meaningful vote” in January, Mrs May is left far adrift from a majority with just 17 days to go to the scheduled date of Brexit on March 29.
March 14 2019
MPs vote to delay Brexit beyond the scheduled date of March 29 in dramatic parliamentary scenes which saw the Conservative Party split down the middle.
More than half of Tory MPs – including seven Cabinet ministers, at least 33 other ministers and whips, and five party vice-chairs – voted against Mrs May’s motion to put back the date when Britain leaves the EU.
March 20 2019
Mrs May tells the House of Commons that that she has written to Donald Tusk to request an extension to the Article 50 Brexit negotiations to June 30. Mr Tusk said a “short extension” to Article 50 should be possible “conditional” upon a positive vote in the UK Parliament.
Mrs May describes the delay to Brexit as a “matter of great personal regret”, adding: “It is now time for MPs to decide.”
March 27 2019
MPs vote down all eight Brexit options in a series of “indicative votes” designed to establish what kind of deal might secure a majority in Parliament.
Proposals for a second referendum on any Brexit deal won 268 votes and a customs union plan won 264, but both were defeated, by 27 and eight votes respectively.
A call for withdrawal without a deal was emphatically rejected by 400 votes to 160.
March 29 2019
MPs reject Mrs May’s Withdrawal Agreement by 286 votes to 344, majority 58, on the day when the UK was due to leave the European Union. She said the implications of the vote were “grave” adding: “I fear we are reaching the limits of the process in this House.”
April 2 2019
Speaking in 10 Downing Street following a seven-hour Cabinet, Mrs May says the UK needs an extension to Brexit talks which is “as short as possible” in order to leave the EU with a deal.
Mr Corbyn has said he is “very happy” to meet Mrs May after she offered to sit down with him to agree a plan.
April 5 2019
Mrs May writes to Mr Tusk asking for an extension to Article 50 to June 30, 2019.
April 10 2019
Mrs May is called back to the European Council summit in Brussels, amid reports that the other 27 leaders have agreed on a Brexit extension to October 31 with a review in June.
Mr Tusk goes on to say the UK has agreed to a “flexible extension” to Brexit until October 31. Mrs May says the “choices we now face are stark and the timetable is clear”.
May 21 2019
Mrs May says there is “one last chance” to help MPs deliver the result of the 2016 referendum, as she offered a “new Brexit deal”.
She said a failure to reach agreement on Brexit would lead to a “nightmare future of permanently polarised politics”.
May 23 2019
The UK votes in the European elections which Mrs May hoped would never have had to be held.
May 24 2019
Mrs May announces she is standing down as Tory party leader on Friday June 7.
She said: “It is and will always remain a matter of deep regret to me that I have not been able to deliver Brexit.”
July 23 2019
Boris Johnson is elected as leader of the Conservative Party and becomes the UK’s next prime minister after defeating Jeremy Hunt. Mr Johnson secured 92,153 of the vote compared to 46,656 for Mr Hunt.
July 24 2019
Mr Johnson uses his first speech in Downing Street to say critics of Brexit – the “doubters, doomsters and gloomsters” – are wrong. He says he is “convinced we can do a deal” to resolve the issue of the Irish border but he would prepare for a no-deal Brexit.
July 25 2019
Mr Johnson said he would work “flat out” to secure a new agreement on Britain’s withdrawal from the EU. But Brussels responds swiftly, with European Commission president Jean-Claude Juncker using his first phone call with the new Prime Minister to say the existing Withdrawal Agreement was “the best and only” deal possible.
Mr Johnson said the Government was “turbocharging” preparations for a no-deal break on October 31 if the EU refused to engage.
July 30 2019
Mr Johnson tells Taoiseach Leo Varadkar that he will approach Brexit negotiations in “a spirit of friendship” but reiterates that any fresh deal must see the backstop abolished.
But Mr Varadkar told him that the emergency measure to prevent a hard border on the island was “necessary as a consequence” of UK decisions.
July 31 2019
Chancellor Sajid Javid announces that more than £2 billion has been earmarked to spend on no-deal Brexit preparations.
August 20 2019
Mr Johnson is rebuffed by Brussels after demanding major changes in a new Brexit deal.
The Prime Minister set out his call for the backstop – the contingency plan to avoid a hard border with Ireland – to be scrapped from the divorce deal ahead of the October 31 Brexit deadline.
But European Council president Donald Tusk defended the measure and warned that those seeking to replace it would risk a return to a hard border on the island of Ireland.
August 27 2019
In a joint statement issued following cross-party Brexit talks led by Mr Corbyn, Westminster opposition leaders said they “agreed on the urgency to act together to find practical ways to prevent no-deal, including the possibility of passing legislation and a vote of no confidence”.
August 28 2019
Mr Johnson rejects claims his decision to hold a Queen’s Speech on October 14 is designed to block MPs from considering ways to thwart his Brexit plans after he was accused of mounting a “coup” against Parliament.
Mr Corbyn says the Prime Minister’s plan to suspend Parliament is “an outrage and a threat to our democracy”.
The Queen approves an order to prorogue Parliament no earlier than September 9 and no later than September 12, until October 14.
August 30 2019
Former prime minister Sir John Major says he wants to join a legal action being brought by campaigner Gina Miller over Mr Johnson’s decision to suspend Parliament.
September 2 2019
Mr Johnson says he is “encouraged by the progress we are making” and the chances of a Brexit deal “are rising”.
He warns that MPs would “chop the legs out” from the UK position if they backed a Brexit extension and stressed there were “no circumstances” in which he would personally seek a delay.
September 3 2019
Mr Johnson says Parliament is “on the brink of wrecking any deal” with Brussels after voting to give a cross-party alliance control of the Commons agenda on Wednesday in a bid to block a no-deal Brexit on October 31.
September 4 2019
A judge at the highest court in Scotland finds that Mr Johnson’s planned prorogation of Parliament is lawful. Meanwhile, Mr Johnson says “there must now be an election on Tuesday October 15” after legislation designed to prevent a no-deal Brexit cleared the Commons. But his attempt to trigger an early general election fails after his motion did not secure the required support of two-thirds of MPs, with the Commons voting 298 to 56.
September 6 2019
A legal challenge brought over Mr Johnson’s decision to suspend Parliament for five weeks is rejected by leading judges at the High Court in London.
September 10 2019
Mr Johnson’s second attempt to trigger an early general election fails after his motion did not secure the required support of two-thirds of MPs, with the Commons voting 293 to 46.
September 11 2019
A legal bid to challenge the suspension of parliament succeeds at the appeal court in Edinburgh, with judges ruling Boris Johnson’s prorogation of parliament was “unlawful”.
The Government says it is “disappointed” by the decision, adding proroguing Parliament was “legal and necessary”.
September 16 2019
Downing Street says Mr Johnson and Jean-Claude Juncker has agreed Brexit talks “needed to intensify”, but the Prime Minister also “reiterated that he would not request an extension” and would take the UK out of the EU on October 31.
September 17 2019
A legal battle over Mr Johnson’s decision to suspend Parliament for five weeks begins at the UK’s highest court. The Supreme Court in London is hearing appeals from two separate challenges
brought in England and Scotland to the prorogation of Parliament over three days.
September 24 2019
Lady Hale, president of the Supreme Court, said the 11 justices had ruled unanimously that Mr Johnson’s advice to the Queen to suspend Parliament until October 14 was unlawful because it had the effect of frustrating Parliament.
October 2 2019
Boris Johnson puts forward his formal Brexit plan to the EU revealing his blueprint to solve the Irish border issue and says it is a compromise but European Commission President Jean-Claude Juncker says there are “still problematic points”.
It sparks 10 days of intense negotiations.
October 4 2019
Documents read out at the Scottish Court of Session reveal Boris Johnson has accepted he will have to send a letter to the EU requesting a delay if an agreement is not reached by October 19, although the Prime Minister later says the UK will leave on October 31 with “no delay”.
October 7 2019
The Court of Session in Edinburgh dismisses a legal case aimed at forcing Boris Johnson to send a letter to the EU requesting a Brexit delay.
October 10 2019
Boris Johnson and Irish taoiseach Leo Varadkar say a Brexit deal “is in everyone’s interest” and they can see a “pathway to a deal” in a joint statement after conducting talks at a luxury hotel in Cheshire.
October 17 2019
After intense negotiations, Prime Minister Boris Johnson announces the UK has reached a “great deal” with the EU that “takes back control” and means that “the UK can come out of the EU as one United Kingdom – England, Scotland, Wales, Northern Ireland, together”.
Mr Johnson said he is “very confident” that when MPs study the deal they will want to vote for it. European Commission president Jean-Claude Juncker says the deal is a “fair and balanced agreement for the EU and the UK and it is testament to our commitment to find solutions”.
But the DUP says it cannot support the deal in Parliament, citing a series of objections over the integrity of the union and Northern Ireland’s economy.