United Kingdom Prime Minister Theresa May survived a crucial Brexit vote on customs on Tuesday. May fought off an attempt by pro-European Conservative MPs to keep open the option of Britain entering into a customs union with the European Union after Brexit.

The UK government, which says a customs union would stop it from striking new trade deals, won by 307 to 301 in the House of Commons, reported BBC. The Opposition Labour party backed a customs union that allows for tariff-free trading between members with a common tariff set for imports from the rest of the world.

Tory legislators reportedly issued threats that it would prompt a no-confidence vote in the prime minister.

The latest vote on the matter was sparked by a debate on Tory MP Stephen Hammond’s amendment to the Trade Bill. It stated that if a free trade area had not been negotiated by January 21, ministers must start discussions on joining a customs union.

International Trade Secretary Liam Fox told Parliament the government’s future Trade Bill was “an important bill providing continuity and stability”. “It will be the confident first step that the UK takes in establishing itself as an independent trading nation,” he said, according to The Journal.

Earlier on Tuesday, May suffered a defeat when MPs backed an amendment by 305 votes to 301 that would keep the UK in the European medicines regulatory network.

On July 12, the British government published a document containing details of its plan to exit the European Union. Theresa May, who unveiled the white paper in Parliament, promised to push through her plan to keep Britain closely tied to the European Union’s single market after Brexit.

The United Kingdom is due to leave the European Union on March 29, 2019, but the two sides are yet to agree how trade will work between them afterwards.