The United Kingdom's decision to leave the European Union marks a historic shift in the nation's relationship not only with Europe but with the world.

The uncertainty of what happens next has spooked investors. That is perhaps understandable: In the short term, there will be costs, not least being the considerable time and effort that must now be spent redefining the rules governing trade between individuals and businesses in the U.K. and their counterparts in other nations.

In the longer term, however, Brexit presents a great opportunity for the U.K. to re-establish itself as a cosmopolitan, classical liberal democracy governed by the rule of law and open to trade. If it takes that path, then its prospects are far brighter than they would have been in an over-regulated, protectionist E.U..

Although recent polls indicated that the vote would be very close, investors had clearly expected the British public to vote to Remain. So when early results indicated that voters were choosing Leave, they reacted with incredulity, dumping Sterling, which fell to $1.32, its lowest level in 30 years, and selling off stocks around the world.

As the sun rose over London, it became clear that Leave had won. At around 8am, as Brits ate their breakfast, the nation's Prime Minister, David Cameron, who had campaigned to remain in the E.U., announced that he would leave office by October. Meanwhile, Scotland's First Minister, Nicole Sturgeon, demanded another vote on Scotland's independence.

In the three days since, social media has been awash with offended middle-class Remain voters describing Leave supporters as stupid and worse, a prankster group used bots to generate over 3 million mostly-fake signatures for a Petition for a new referendum on the U.K. Parliament's website (in an ironic twist, the petition was started by a Leave supporter), and a Labour MP has called on Parliament to reject the non-binding referendum vote.

European politicians are in disarray over the vote. On Friday, Jean-Claude Juncker, President of the European Commission called for a speedy exit, reportedly saying that Brexit was "not an amicable divorce" but that "it was not exactly a tight love affair anyway". And the Czech foreign minister has called for Juncker to resign, blaming him for Brexit. Meanwhile, Donald Tusk, President of the European Council, and other E.U. leaders, including German Chancellor Angela Merkel, have encouraged Britain's Parliament to reconsider.

For Britain formally to begin the process of leaving the E.U., it must—according to Article 50 of the Lisbon Treaty—notify the E.U. of that decision. The terms and date of exit will then be determined by agreement—but by default will occur two years after notification. While Britain has not yet formally notified the E.U. of its intention to leave, David Cameron has established an "E.U. Unit" in his cabinet, whose function is to develop the exit strategy.

Assuming that Parliament does not over-ride the referendum result, many vexing decisions must now be taken, among them: What should be Britain's trade policy? How should immigration be reformed? And which British regulations required by the E.U. should be kept and which scrapped? To make matters worse (or at least more confusing), these questions are not necessarily independent of one another.

Taking trade first: At present, the U.K. is part of the E.U. customs union and practically all trade policy decisions are made on an E.U.-wide basis. At present, all trade between the U.K. and other E.U. member states is tariff free—there are no taxes on import or exports. That applies not only to goods (which means anything physical, from oil to toasters) but also to services (such as computer programming, architecture, and financial planning) and capital (investments of various kinds). This preferential treatment for trade within the E.U. created a tendency for transactions to remain within the customs union. However, the slow growth of most E.U. economies compared with other less heavily regulated economies has resulted in a decline in the share of British trade with the E.U.—from about 55 percent in 1999 to 45 percent in 2015.

The rapid growth of Asian economies over the past three decades was driven in part by unilateral trade liberalization. Britain could potentially benefit enormously by following that route. Unilaterally removing external restrictions on imports of goods, services and capital would be both the simplest and in many respects the best policy, since it can be undertaken without the need for any intergovernmental negotiation. It would ensure that consumers and producers in the U.K. had access to these inputs at the lowest possible cost. This would drive stronger domestic competition, resulting in higher rates of innovation and growth.

A second, largely complementary, option is for the U.K. independently to join the World Trade Organization (WTO). The advantage of joining this multilateral agreement is that it limits the tariffs and other restrictions other members can impose on British exporters. However, accession to the WTO is not automatic and might take years, so should not be seen as an alternative to unilateralism: any delay in the removal of trade restrictions will harm the British economy.

A third option, which again is largely complementary to both unilateralism and membership of the WTO, is to join the European Free Trade Association (EFTA). This association, which currently comprises Norway, Iceland, Lichtenstein, and Switzerland (all non-E.U. states), impose no tariffs on goods traded between them. Apart from the immediate benefits of mutual free trade, joining EFTA would signal Britain's continued commitment to trade and comity with other European nations—and perhaps encourage other E.U. members considering withdrawal to embrace an arrangement based on trade rather than political patronage. Membership of EFTA would also bring the U.K. automatic membership of the 27 free trade agreements EFTA has negotiated for its members.

A fourth option would be for Britain to seek to negotiate trade agreements with various other nations, including Canada, Australia, and, of course, the United States. There is a danger that such negotiations could become very protracted, so again this option should be considered subordinate to unilateral liberalization and, in the first instance, to minimize the complexity of such negotiations, it might be best if Britain were to identify a basic set of principles that could be applied to all potential partners in free trade.

Turning to immigration: If Britain were to join EFTA, it might also have the option of joining the European Economic Area (EEA), which currently comprises three of the EFTA nations, Norway, Iceland, and Lichtenstein. Under EEA rules, the U.K. would maintain free movement of goods, services, capital, and people across all E.U. and EEA states. But that would effectively leave Britain with the same E.U. migration policy that has become so contentious with many in the Leave camp. Moreover, EEA members are also required to comply with E.U. regulations related to these activities—without having any say in the content of those regulations. Given that a key reason for the U.K. leaving the E.U. is the lack of transparency and accountability of the E.U.'s decision-making processes—and the arbitrary, capricious, and economically sclerotic regulations that have resulted—EEA membership is likely a non-starter.

There are many potential alternative immigration policies. The libertarian in me wants to advocate totally open migration but that would be even less politically acceptable in the current U.K. than joining the EEA.

So, some kind of restricted migration policy is, I think, inevitable. One way to do this would be to adopt an employment-based system of some kind. Sweden has arguably the best such system; it permits anyone with a qualifying job to migrate—removing much of the uncertainty, delay and cost of the kind of employment-based visa process now in place in the U.K. (and similar processes in the U.S.).

But there is a fundamental problem with all employment-based immigration systems, namely that they require immigrants to have a job prior to migration. This imposes high costs on both the firms seeking to employ migrants, which typically bear the cost of visa applications, and on immigrants, who must find jobs in foreign countries, go through selection processes, etc.

An alternative system, proposed by the late Nobel Prize–winning economist Gary Becker is to sell the right to migrate. This idea has the advantage that it does not require a person to have a job prior to migration, nor does it impose arbitrary restrictions based on current location, academic qualifications, or family relationships.

The main problem with this system is the difficulty knowing the "correct" price. Set the level too high and Britain would suffer from a lack of skilled labor, meaning that the cost of plumbing would rise unacceptably; set it too low and there might be a flood of migrants, leading to the same concerns that have been raised by the current opponents of open migration.

An additional problem with selling the right to migrate is that it does not accommodate those who might otherwise be permitted to immigrate on compassionate grounds, such as asylum seekers, refugees or family members. So, accommodation would have to be made for these people.

Last but by no means least, Britain will have to find a way to decide which of the thousands of regulations that derive from E.U. legislation to keep and with to discard. Britain has on several occasions sought to cut red tape, establishing various Parliamentary committees charged with deregulating the economy. Last year, Parliament passed a new Deregulation Act that again sought to reduce some of the red tape that has become so burdensome. But all of these changes were piecemeal and none could to stem the tide of E.U. legislation.

A recent example of E.U. regulation is the Tobacco Products Directive, which among other things imposed all manner of arbitrary and unnecessary restrictions on the types of vaping products that may be sold, including a maximum tank size of 2ml (many of the most popular tanks are currently 5ml), and a limit of 2 percent on the amount of nicotine in liquids (many contain more, and higher levels are seen as helpful for those in the first stages of switching from far more harmful combustible cigarettes).

Previous attempts at deregulation simply didn't have sufficient teeth. One solution would be automatically to sunset all E.U.-derived regulations at the date the E.U. exits the E.U.—which will be two years after it invokes (which will likely take place soon after a new Prime Minister is installed in October). During those two years, Parliament could investigate the need for those regulations and prioritize the reinstantiation of any deemed, on net, to be desirable. By making deregulation the default and imposing a limited timeframe, Parliament will be forced to prioritize more effectively than has previously been the case.

Britain's current relationship with the E.U. is untenable and must change. But that change should be an improvement on the status quo—and it must take into consideration the fact that the referendum was won only narrowly. As Daniel Hannan, a British Member of the European Parliament and one of the leading proponents of Leave, wrote on the day of the referendum,

"If, as I hope, we vote to leave, we won't be able simply to ignore the concerns of those who wanted to stay. A narrow leave vote is not a mandate for anything precipitate or radical. It is a mandate for a phased repatriation of power, with the agreement, wherever possible, of our European allies. Many of our existing arrangements will remain in place; and those which we want to disapply won't be scrapped overnight. Brexit, in other words, will be a process rather than an event. It will be the moment when Britain starts to pursue a different trajectory, away from political union with the E.U. and toward a looser arrangement based on trade and co-operation."

David Cameron has already initiated the process by which the U.K. government will negotiate with the E.U.. I have argued, in line with Hannan's observation, that a looser arrangement based on open trade with the E.U. and all other nations, an immigration policy that is more rational and humane, and the removal of many of the arbitrary and capricious regulations developed by bureaucrats in Brussels could lead to a much freer society. That would be a good thing for the people of Britain. It might also set an example for the rest of Europe.