BRUSSELS (AP) — The European Union took legal action against Britain on Thursday over its plans to pass legislation that would breach parts of the legally binding divorce agreement the two sides reached late last year.

The EU action underscored the worsening relations with Britain, which was a member of the bloc until Jan. 31. Both sides are trying to forge a rudimentary free trade agreement before the end of the year, but the fight over the controversial U.K. Internal Market bill has soured relations this month.

European Commission President Ursula von der Leyen said that the British plan "by its very nature is a breach of the obligation of good faith laid down in the Withdrawal Agreement."

"If adopted as is, it will be in full contradiction to the protocol of Ireland-Northern Ireland" in the withdrawal agreement," she said.

EU leaders fear that if the U.K. bill becomes law, it could lead to the reimposition of a hard land border between Northern Ireland, which is part of Britain, and EU member Ireland, and erode the stability that has underpinned peace since the 1998 Good Friday accord.

The EU had given London until Wednesday to withdraw the bill, but U.K. lawmakers voted 340-256 Tuesday to push the legislation past its last major hurdle in the House of Commons.

Von der Leyen said “the deadline lapsed yesterday. The problematic provisions haven't been removed. Therefore this morning, the commission has decided to send a letter of formal notice to the U.K. government,” which augurs the start of a protracted legal battle.

“The commission will continue to work hard towards a full and timely implementation of the Withdrawal Agreement," she said. "We stand by our commitment.”

The bill must also be approved by the U.K.'s House of Lords, where it is sure to meet strong opposition because it breaches international law.

The British government stood its ground in an immediate reaction, saying “we need to create a legal safety net to protect the integrity of the U.K.’s internal market, ensure ministers can always deliver on their obligations to Northern Ireland and protect the gains from the peace process.”

If the Internal Market Bill becomes law, it will give Britain the power to disregard part of the Brexit withdrawal treaty dealing with trade to and from Northern Ireland, which shares a 300-mile (500-kilometer) border with the Republic of Ireland.

The U.K. government says it respects the Good Friday peace accord and the Brexit withdrawal agreement, but wants the law in case the EU makes unreasonable demands after Brexit that could impede trade between Northern Ireland and the rest of the U.K.

Prime Minister Boris Johnson’s large parliamentary majority ensured the bill passed its final House of Commons vote on Tuesday night, despite resistance from opposition parties and even some members of the governing Conservative Party.

At the same time, EU and U.K. officials were continuing talks on a trade deal, going into detailed negotiations over everything from fisheries rights, state aid rules and legal oversight in case of disputes.

Time is short for the U.K. and the EU to mend fences. A transition period that followed Britain’s Brexit departure ends in less than 100 days, on Dec. 31.

The EU-U.K. trade negotiating session is supposed to wrap up Friday but expectations are that negotiations will continue right up to an Oct. 15-16 EU summit, which British Prime Minister Boris Johnson has set as a deadline for a deal. The EU said talks could continue right up to the end of the month.

Britain says it wants a free trade deal along the lines of the one the EU has with Canada, allowing for goods to be traded with no tariffs or quotas.

The EU says if the U.K. wants access to EU markets it must respect standards that EU companies have to live by since Britain is just too close to allow for undercutting rules that would allow for so-called “dumping” of U.K. merchandise at prices lower than in the EU.

___

Jill Lawless reported from London.