Here are the key dates of Britain's often troubled history within the European Union, which comes to an end tonight.

Joining up

9 August 1961: Britain formally applies to join what was then called the European Economic Community (EEC).

14 January 1963: France's president Charles de Gaulle vetoes the application. He rejects it again on 27 November 1967.

1 January 1973: Britain finally enters the EEC at the same time as Ireland and Denmark, after De Gaulle has left office.

5 June 1975: In a referendum called by the new Labour government on remaining in the EEC, more than 67% of Britons vote "Yes".

Thatcher versus Europe

30 November 1979: New Conservative prime minister Margaret Thatcher demands a rebate on Britain's contribution to the European budget, reportedly demanding at a summit: "I want my money back." She gets her way in 1984.

20 September 1988: Thatcher gives a speech in the Belgian city of Bruges that becomes a rallying cry among eurosceptics for less European political integration.

British opt-outs

7 February 1992: A new stage of political and economic integration is launched by the Maastricht Treaty under which the bloc becomes the European Union.

Britain secures an opt-out from some provisions, including joining a planned single currency.

23 July 1993: After infighting in his governing Conservative Party over integration in Europe, prime minister John Major survives a confidence vote.

'Leave' vote

23 June 2016: At a 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.

29 March 2017: Mr Cameron's successor, Theresa May, starts the two-year countdown to Britain leaving the EU with a formal letter of notice to EU president Donald Tusk.

22 November 2018: Britain and the EU reach a provisional agreement on their post-Brexit relations, a week after striking a draft divorce deal. It is formalised on 25 November by EU leaders.

Impasse

15 January 2019: Britain's lower house of parliament votes against the deal, the first of three times it will do so.

22 March: The EU approves delaying Brexit to 12 April.

10-11 April: The EU agrees to delay Brexit until 31 October.

24 July: Brexit figurehead Boris Johnson replaces May as prime minister, vowing to take Britain out of the EU on 31 October with or without a deal.

New deal, new delay

17 October: European Commission president Jean-Claude Juncker and Mr Johnson announce their agreement on a new draft Brexit accord.

The British parliament delays its vote on the text, forcing Mr Johnson to ask Brussels for a new postponement of the Brexit date. It is set for 31 January 2020.

At snap elections on 12 December, Mr Johnson's Conservatives secure a large parliamentary majority, ensuring easy passage for his divorce deal.

Brexit a reality

31 January 2020: Brexit comes into force at 11pm British and Irish time.

There will be a transition period until at least 31 December 2020, to allow both sides to work out their new relationship, notably on trade.