The European Union agreed to give Great Britain until Oct. 31 to figure out a plan for exiting the union, setting the stage for more political turmoil in Westminster.

EU member states agreed to the extension Wednesday after UK Prime Minister Theresa May's last-ditch lobbying efforts.

EU Council President Donald Tusk tweeted that EU members and the UK had agreed on a "flexible extension until 31 October."

The UK was supposed to leave the union by March 31, under terms of the Brexit referendum approved two years ago. But the failure of Parliament to approve a plan for dealing with many issues, including how to manage the border between Northern Ireland and the Irish Republic, prevented a clean exit.

At the same time, Parliament voted against leaving the EU without any agreement, placing May's government in the awkward position of lobbying for more time to arrange a deal.

The pound was modestly higher against the U.S. dollar in the wake of the decision.