The UK is urgently drawing up new laws that will enable it to continue imposing sanctions on foreign countries after Brexit, the BBC has learned.
Ministers began consulting on the plans last week after officials realised most of the powers to apply sanctions will disappear when the UK leaves the EU.
The government hopes the move will allow it to continue to adopt sanctions alongside other members of the bloc.
EU law is mostly used now for a travel ban, asset freeze or trade embargo.
This UK's move matters because some countries - including Germany - fear that Brexit will change the balance of debate within the EU and encourage nations such as Italy and Spain to argue that sanctions on Russia should be relaxed.
The EU has imposed trade restrictions on Russia's financial, energy and defence sectors in response to its annexation of Crimea and military intervention in Ukraine.
The official consultation over the new laws began last Friday only hours before the pre-election ban on announcing new legislation - known as purdah - came into force.
It will be rushed through in just nine weeks so a new bill can be put to Parliament as soon as possible after the general election in June.
As a member of both the United Nations and the EU, the UK is obliged to implement any sanctions that either body decides to impose. These tend to involve travel bans, asset freezes and restrictions on finance and trade.
But crucially, the UK uses European law to implement most of these sanctions, regardless of whether they originated at the UN or the EU.
This is because decisions to restrict trade or money or the movement of people tend to be dealt with exclusively at EU level.
The EU currently imposes some 30 sanction regimes, of which about half flow from the UN.
These involve restrictions against people and institutions and trade in Russia, North Korea, Syria, Iraq, Iran and many other countries.
The new laws will allow the UK for the first time to impose substantial sanctions on another country's trade by itself.
At the moment, the UK has only limited powers to impose some financial sanctions unilaterally, such as through the Terrorist Asset Freezing etc Act 2010 or the the Anti-terrorism, Crime and Security Act 2001.
New legislation is needed to amend existing sanctions or introduce new ones after Brexit because the planned Great Repeal Bill would only be able to maintain current sanctions.
National security agenda
The White Paper says that "when the UK withdraws from the EU we will need new legal powers that are compliant with our domestic legal system. These will enable us to preserve and update UN sanctions, and to impose autonomous UK sanctions in coordination with our allies and partners."
It also hints that the government may take new powers to use sanctions in counter-terrorism operations.
"We need to ensure that UK counter-terrorist sanctions powers remain a useful tool for UK law enforcement and intelligence agencies, including ensuring that we can cooperate with international partners and allies," the document says.
Peers on the House of Lords' EU justice sub-committee alerted the government to the problem in February, saying: "The UK has contributed greatly to the substance and quality of improvements in the sanctions process over the last few years.
"It is, therefore, particularly important that the UK should remain able to align itself with EU sanctions post-Brexit. National legislation to achieve this must be put in place."
The Foreign Office minister who will take the bill through parliament, Sir Alan Duncan, said: "The government's over-arching goal is to ensure we have in place the legal powers needed to continue to implement sanctions regimes effectively, in support of our wider national security and foreign policy agenda.
"The UK plays a leading global role in using sanctions to reduce threats to international peace and security and we will continue to do so when we leave the European Union."
The scale of the UK's declining influence over EU sanctions was revealed this month when Foreign Secretary Boris Johnson failed to persuade other EU countries to agree new measures against Russia after its Syrian allies were accused of using chemical weapons.
Correction 11 May 2017: The reference to the Syria chemical attack has been amended to reflect that there is still some dispute over who was responsible.