With the clock ticking down, the United Kingdom and the European Union have finally agreed to a free trade deal a week before the Brexit transition period ends and 4 1/2 years since Britons voted in a landmark referendum to leave the EU.

The two sides were able to reach agreement by resolving a difficult dispute over fishing. The issue: how much to reduce European fleets' share of the catch in British fishing grounds in the coming years?

Fish account for less than 1% of the British economy, but played an outsize role in negotiations. The winning campaign slogan from the 2016 Brexit referendum was to "take back control" from the EU and that included fishing grounds.

The U.K. and the EU also found agreement on what's known as the "level playing field" — adherence to regulations on the environment, workers' rights and state subsidies that ensure businesses in one country, in this case the U.K., don't enjoy an unfair advantage over those in the EU.

The deal averts a worst-case divorce that would have hurt the EU economy but damaged the British economy even more. Had the U.K. walked away from the EU single market of nearly 450 million consumers empty-handed, the country could have lost more than 8% of growth in per capita income over the next decade, according to The UK in a Changing Europe, a leading group of academic researchers. A so-called no-deal Brexit also threatened to engulf British ports in regulatory and customs chaos at the turn of the year.

The U.K. got a glimpse of what that could look like last weekend when France closed the border after a coronavirus variant that scientists believe is much more infectious spread throughout London and southeastern England. The border closure caught the British government off guard and stranded thousands trucks around the Port of Dover. France reopened the border Wednesday, but said that travelers and truckers — most of them European — could not cross the English Channel unless they tested negative for the coronavirus.

The new trade deal is what is known as a hard Brexit, meaning the British and EU economies will no longer have the close regulatory alignment they've enjoyed for decades. Economists say that even with the deal, Britain's per capita income will be 6.4% lower over the next decade than it would've been if the U.K. had remained part of the EU.

Prime Minister Boris Johnson has argued that leaving the EU will benefit the U.K. in the long run. He says it will allow Britain to negotiate independent free trade deals with other major economies, such as the United States and China, unencumbered by the bureaucracy, regulations and collective decision-making in Brussels, where the union is headquartered.

Being part of the European Union has meant U.K. companies could trade smoothly with Europe without tariffs or customs checks as if they were inside the same country. But one price of membership had been that EU citizens were allowed to live and work visa-free inside the U.K. It was amid anxiety over migration that British voters stunned the world in 2016 and voted to leave the EU.

The U.K. has spent most of this year in a transition period, which ends Dec. 31. Disruptions and backups at ports are could well follow as customs controls and new processes come into force at EU borders.

To minimize delays, the British government has told U.K. truckers that they will have to obtain a permit to enter the county of Kent, home to the Port of Dover and the Eurotunnel on the channel.

The deal still requires approval by the British Parliament and will be scrutinized by the governments of the EU's 27 member-states. But this agreement begins to draw to a close one of the most tumultuous chapters in contemporary British history.

Brexit toppled two prime ministers — David Cameron and Theresa May — caused chaos in the U.K. Parliament and weakened the country's economy as well as its standing in the world. After decades in the European Union, which was designed to promote peace and prosperity after two world wars, the island nation of nearly 67 million people will strike out on its own. Many political analysts are skeptical of the move and view it as one of the greatest self-inflicted wounds by a major democracy in many years.

The ultimate timing of the end of the Brexit saga is especially bad. The United Kingdom continues to grapple with the coronavirus pandemic, which has killed more than 69,000 people — one of Europe's highest death tolls. Gross domestic product in Britain is expected to fall by 11% this year. That would be the largest drop since the Great Frost of 1709, when temperatures plunged in large parts of Europe, destroying crops, killing hundreds of thousands of people in France and devastating economies.

Copyright 2020 NPR. To see more, visit https://www.npr.org.