In 1957, France, West Germany, Belgium, Italy, Luxembourg and the Netherlands signed the Treaty of Rome, which established the European Economic Community (EEC), the predecessor of today’s European Union. It was the latest of several attempts to foster economic cooperation between European nations in the wake of World War II. Nations that traded together, it was believed, would be less likely to go to war with each other.

When the United Kingdom first applied for membership in the EEC in 1963, France’s President Charles de Gaulle vetoed its application. "He had a lot of experience of the British and he always thought that they'd be on the Americans' side… so I don't think he believed that they'd play the game of Europe," Edith Cresson, former Prime Minister of France, told the BBC in December 2017. "Formally they'd be in, but actually they'd always be with the Americans."

The UK finally made it into the club in 1973, but just two years later was on the verge of backing out again.

In 1975, the nation held a referendum on the question: “Do you think the UK should stay in the European Community (Common Market)?” The 67 percent “Yes” vote included most of the UK’s 68 administrative counties, regions and Northern Ireland, while only Shetland and Western Isles voted “No.” The center-left Labour Party split over the issue, with the pro-Europe wing splitting from the rest of the party to form the Social Democratic Party (SDP).

Tensions between the EEC and the UK exploded in 1984, when the Conservative Prime Minister Margaret Thatcher talked tough in order to reduce British payments to the EEC budget. Though at the time the UK was the third-poorest nation in the Community, it was paying a lot more into the budget than other nations due to its relative lack of farms. Farm subsidies then made up some 70 percent of total EEC expenditures. The UK “rebate” negotiated by Thatcher remains in place today, and has reduced Britain’s contribution to the budget from more than 20 percent of the total in the ‘80s to about 12 percent.

The Maastricht Treaty, which took effect in 1993, created the Brussels-based European Union (EU), of which the EEC, renamed simply the European Community (EC) was the main component. The EU was designed to integrate Europe’s nations politically and economically, including a united foreign policy, common citizenship rights and (for most member nations, not including the UK) a single currency, the euro.

Labour Prime Minister Tony Blair, who won a landslide victory in 1997, was strongly pro-European Union, and worked to rebuild ties with the rest of Europe while in office. He had his work cut out for him: In the midst of the “mad cow” (bovine spongiform encephalopathy) scare of the late ‘90s, Brussels imposed a ban on British beef. The general EU ban was lifted in 1999, after tough restrictions were imposed on beef exports, but France kept its own ban in place for years after that.

Europe and the UK didn’t just battle over beef. In 2000, after a 27-year-long battle and a victorious verdict from the European Court of Justice in Luxembourg, British chocolate could finally be sold in the rest of Europe. Purists in France, Belgium, Spain and Italy, among other nations, had argued that only cocoa butter, and not vegetable oil, should be used when making chocolate. They also thought British-made chocolate–including popular brands like Mars Bars, Kit-Kats and Cadbury’s–had far too much milk, and wanted it to be labeled as “household milk chocolate,” “chocolate substitute” or even “vegelate.”

In 2007, after plans for an official EU constitution collapsed, the member nations finished negotiating the controversial Lisbon Treaty, which gave Brussels broader powers. Labour Prime Minister Gordon Brown famously missed a televised ceremony in which the leaders of the 26 other member nations signed the treaty. He later signed the document, but was criticized for failing to defend a treaty he had helped to negotiate.

In the interests of protecting Britain’s financial sector, David Cameron became the first UK prime minister to veto a EU treaty in 2011. In early 2013, he gave a much-anticipated speech in which he outlined the challenges facing Europe and promised to renegotiate membership in the EU if his Conservative Party won a majority in the next general election. At the same time, support was growing among British voters for the UK Independence Party (UKIP) and its hard line stance against the EU.

Against the backdrop of economic unrest in the eurozone (as the territory of the 19 EU countries that use the euro is known) and an ongoing migrant crisis, UKIP and other supporters of a possible British exit from the EU—or Brexit—increased. After winning reelection in May 2015, Cameron went to work renegotiating the UK-EU relationship, including changes in migrant welfare payments, financial safeguards and easier ways for Britain to block EU regulations. In February 2016, he announced the results of those negotiations, and set June 23 as the date of the promised referendum.

Turnout for the referendum was 71.8 percent, with more than 30 million people voting. The referendum passed by a slim 51.9 percent to 48.1 percent margin, but there were stark differences across the UK. Northern Ireland voted to remain in the EU, as did Scotland (where only 38 percent of voters chose “leave”), leading to renewed calls for another referendum on Scottish independence. England and Wales, however, voted in favor of Brexit.

In October 2016, Prime Minister Theresa May, who had assumed office following David Cameron’s resignation, announced her intention to invoke Article 50 of the Treaty on European Union, formally giving notice of Britain’s intent to leave the EU. On March 29, 2017, the order, signed by May a day earlier, was delivered to the Council of the European Union, officially starting the two-year countdown to Britain’s EU departure, set for March 30, 2019. However, on March 30, 2019, Parliament rejected May's EU withdrawal agreement. The European Council set a new deadline of October 31, 2019, or the first day of the month after that in which a withdrawal agreement is passed—whichever comes sooner.