Even before Brexit, Britain and the European Union had an often troubled history. Here are some key dates in what was a turbulent coupling from the outset.
1. De Gaulle Veto
On 9 August 1961 Britain formally applies to join what was then called the European Economic Community (EEC).
But France's president Charles de Gaulle vetoes the application in 1963, shutting the door on UK membership again in 1967.
Britain finally enters the EEC on 1 January 1973, at the same time as Ireland and Denmark, after de Gaulle has left office.
In a referendum called by Harold Wilson's new Labour government on whether to remain in the EEC on 5 June, 1975, more than 67% of Britons vote "Yes".
2. Thatcher versus Europe
On 30 November, 1979, new Conservative prime minister Margaret Thatcher demands a rebate on Britain's contribution to the European budget, reportedly saying: "I want my money back." She gets her way in 1984.
Thatcher gives a speech in the Belgian city of Bruges on 20 September, 1988, that becomes a rallying cry among eurosceptics for less European political integration.
3. British opt-outs
The Maastricht Treaty in 1992 ushers in a new era of political and economic integration. Britain secures an opt-out from some provisions, including joining a planned single currency.
After infighting over Europe inside his governing Conservative Party, prime minister John Major survives a confidence vote on 23 July, 1993.
4. UK votes to leave
In a 23 June, 2016, referendum organised after the Conservatives come to power in 2015, Britain votes by 52% to 48% to quit the EU. Prime minister David Cameron, who had campaigned to remain, resigns.
The following year Cameron's successor, Theresa May, starts the two-year countdown to Britain leaving the bloc with a formal letter of notice to EU president Donald Tusk.
Britain and the EU reach agreement on a divorce deal in November 2018.
Britain's lower house of parliament votes against the deal on 15 January, 2019, the first of three times it will do so.
Brexit is delayed to 29 March, then to 30 June, then to 31 October.
Leading Brexit campaigner Boris Johnson replaces May as prime minister on July 24, vowing to take Britain out of the EU with or without a deal.
6. New deal, new delay
With the clock ticking, on 17 October European Commission president Jean-Claude Juncker and Johnson announce agreement on a new draft Brexit accord.
The British parliament delays its vote on the text, forcing Johnson to ask Brussels for a new Brexit postponement. It is set for 31 January, 2020.
At a snap election on 12 December, Johnson's Conservatives secure a large parliamentary majority, ensuring easy passage for his divorce deal.
7. Brexit a reality, but...
On 31 January, 2020, Brexit eventually happens.
Crucial talks on future ties and trade with the bloc then start in March, but break deadline after deadline as negotiators try to avert a no-deal Brexit on 31 December.
The two sides finally announce a deal on 24 December.