Britain's Prime Minister Boris Johnson gestures as he speaks in the House of Commons in London during the debate for the EU Withdrawal Agreement Bill, Tuesday Oct. 22, 2019. British lawmakers have rejected the government’s fast-track attempt to pass its Brexit bill within days, demanding more time to scrutinize the complex legislation and throwing Prime Minister Boris Johnson’s exit timetable into chaos. (Jessica Taylor, UK Parliament via AP)

LONDON (AP) — For a brief moment Tuesday, Brexit was within a British prime minister's grasp.

Boris Johnson won Parliament's backing for the substance of his exit deal but lost a key vote on its timing, a result that inches him closer to his goal of leading his country out of the European Union — but effectively guarantees it won't happen on the scheduled date of Oct. 31.

European Council President Donald Tusk tweeted that because of the vote he would recommend that the other 27 EU nations grant Britain a delay in its departure to avoid a chaotic no-deal exit in just nine days.

The good news for the prime minister was that lawmakers — for the first time since Britons chose in 2016 to leave the EU — voted in principle for a Brexit plan, backing by 329-299 a bill to implement the agreement Johnson struck with the EU last week.

But minutes later, legislators rejected his fast-track timetable to pass the bill, saying they needed more time to scrutinize it. The vote went 322-308 against the government.

Tuesday's votes plunge the tortuous Brexit process back into grimly familiar territory: acrimonious uncertainty.

Without speedy passage of the bill, Britain won't be able to make an orderly exit from the bloc on Oct. 31, the central vow of Johnson's three-month-old administration.

Looking on the bright side, Johnson hailed the fact that "for the first time in this long saga this House has actually accepted its responsibilities together, come together, and embraced a deal."

"One way or another we will leave the EU with this deal to which this House has just given its assent," he said — though he also said the government would "accelerate" preparations for a no-deal outcome because of the uncertainty.

Johnson had hoped to push the legislation through the House of Commons by Thursday. But he said after the defeat that he would "pause" the bill until the EU had decided whether to agree to delay Britain's departure.

On Tuesday night, Tusk tweeted that he would recommend that the bloc grant Britain's request for an extension to the Oct. 31 deadline. He did not say how long a delay he would recommend, although the U.K.'s request was to postpone exit until Jan. 31.

That request came grudgingly from Johnson last week to comply with a law passed by Parliament ordering the government to postpone Brexit rather than risk the economic damage that could come from a no-deal exit.

Any delay will still require the agreement of all of the other 27 EU member states, and they are deeply weary of the long-running Brexit saga. French Foreign Minister Jean-Yves Le Drian told French lawmakers Tuesday that he sees "no justification" at this stage for a further delay.

But they also want to avoid the economic pain on both sides of the Channel that would come from a chaotic British exit.

Earlier, Johnson had said he might call a vote on holding a snap general election if Parliament blocked his plans — in the hopes of breaking the political deadlock over Brexit that has dragged on as lawmakers have squabbled over the country's departure terms. But he's likely to wait to hear from the EU on the delay request before deciding whether to push for an election.

But before Tuesday's vote, he said: "I will in no way allow months more of this."

Last week Johnson struck a divorce deal with the other EU leaders, but on Saturday he failed to win Parliament's backing for it. His only remaining hope of leaving on time was to get lawmakers to pass the Brexit-implementing bill into law before the scheduled departure date, nine days away.

The Brexit deal sets out the terms of Britain's departure, including measures to maintain an open border between the U.K.'s Northern Ireland and EU member Ireland. It also enshrines the right of U.K. and EU citizens living in the other's territory to continue with their lives, and sets out the multibillion pound (dollar) payments Britain must make to meet its financial obligations to the EU.

But the deal does not cover the nitty gritty of future relations between the U.K. and the EU: Instead, it confirms a transition period lasting until at least the end of 2020 — and possibly 2022 — in which relations will remain frozen as they are now while a permanent new relationship is worked out.

If Britain leaves the EU without a deal, there will be no transition period, uncertainty for millions of citizens and a host of new tariffs, customs checks and other barriers to trade on Day 1. Most economists say that would send unemployment rising, the value of the pound plummeting and plunge the U.K. into recession.

Many lawmakers felt that three days was not nearly enough time for scrutiny of the 115-page bill. Major bills usually take weeks or months to pass through Parliament, giving time for line-by-line scrutiny by lawmakers.

Before Tuesday's votes, Green lawmaker Caroline Lucas tweeted that lawmakers "had more time to debate the Wild Animals in Circuses Act (affecting 19 animals) than they will to decide the future of 65 million people. It's hard to think of anything which better illustrates this Govt's contempt for people, Parliament & democracy."

After the votes, many lawmakers urged Johnson to push ahead with the bill after securing a delay to Brexit. Opposition Labour Party leader Jeremy Corbyn encouraged the prime minister to "work with us all of use to agree a reasonable timetable" for its passage.

Leader of the House of Commons Jacob Rees-Mogg, an ardent Brexit supporter, acknowledged that the prospect of an Oct. 31 Brexit now seemed remote.

"Impossible is a very strong word, but it is very hard to see how it is possible," he said.

___

Associated Press writers Gregory Katz in London and Lorne Cook and Sam Petrequin in Brussels contributed to this report.

___

Follow AP's full coverage of Brexit and British politics at https://www.apnews.com/Brexit

Britain's Prime Minister Boris Johnson, center, sits on the government front bench in the House of Commons in London following the debate for the EU Withdrawal Agreement Bill, Tuesday Oct. 22, 2019. British lawmakers have rejected the government’s fast-track attempt to pass its Brexit bill within days, demanding more time to scrutinize the complex legislation and throwing Prime Minister Boris Johnson’s exit timetable into chaos. (Jessica Taylor, UK Parliament via AP)
British Prime Minister Boris Johnson speaking in the House of Commons, London during the debate for the European Union Withdrawal Agreement Bill: Second Reading. Tuesday, Oct. 22, 2019. British Prime Minister Boris Johnson's European Union divorce bill faces two votes Tuesday, with lawmakers first being asked to approve it in principle, followed by a vote on the government's schedule for debate and possible amendments. (House of Commons/via AP)
Pro-Brexit protesters hold out their placards and flags as traffic moves past the Houses of Parliament in London, Monday, Oct. 21, 2019.  The European Commission says the fact that British Prime Minister Boris Johnson did not sign a letter requesting a three-month extension of the Brexit deadline has no impact on whether it is valid and that the European Union is considering the request. (AP Photo/Alastair Grant)
European flags placed by remain in the European Union anti-Brexit supporters fly backdropped by the Houses of Parliament in London, Tuesday, Oct. 22, 2019. British Prime Minister Boris Johnson's European Union divorce bill faces two votes Tuesday, with lawmakers first being asked to approve it in principle, followed by a vote on the government's schedule for debate and possible amendments. (AP Photo/Matt Dunham)
An anti Brexit demonstrators banner near Parliament in London, Tuesday, Oct. 22, 2019.British lawmakers from across the political spectrum were plotting Tuesday to put the brakes on Prime Minister Boris Johnson's drive to push his European Union divorce bill through the House of Commons in just three days, potentially scuttling the government's hopes of delivering Brexit by Oct. 31.(AP Photo/Kirsty Wigglesworth)
British Prime Minister Boris Johnson speaking in the House of Commons, London during the debate for the European Union Withdrawal Agreement Bill: Second Reading. Tuesday, Oct. 22, 2019. British Prime Minister Boris Johnson's European Union divorce bill faces two votes Tuesday, with lawmakers first being asked to approve it in principle, followed by a vote on the government's schedule for debate and possible amendments. (House of Commons/via AP)
European Commission President Jean-Claude Juncker delivers his speech at the European Parliament Tuesday, Oct. 22, 2019 in Strasbourg, eastern France. Britain faces another week of political gridlock after British lawmakers on Monday denied Prime Minister Boris Johnson a chance to hold a vote on the Brexit divorce bill agreed in Brussels last Thursday. (AP Photo/Jean-Francois Badias)
European Union chief Brexit negotiator Michel Barnier delivers his speech Tuesday, Oct. 22, 2019 at the European Parliament in Strasbourg, eastern France. Britain faces another week of political gridlock after British lawmakers on Monday denied Prime Minister Boris Johnson a chance to hold a vote on the Brexit divorce bill agreed in Brussels last Thursday. (AP Photo/Jean-Francois Badias)
Britain's Secretary of State for Exiting the European Union Steve Barclay arrives for a cabinet meeting at 10 Downing Street in London, Tuesday, Oct. 22, 2019. British Prime Minister Boris Johnson's European Union divorce bill faces two votes Tuesday, with lawmakers first being asked to approve it in principle, followed by a vote on the government's schedule for debate and possible amendments. (AP Photo/Matt Dunham)
Scottish Nationalist Party Westminster leader Ian Blackford speaking in the House of Commons, London during the debate for the European Union (Withdrawal Agreement) Bill: Second Reading. Tuesday Oct. 22, 2019. British Prime Minister Boris Johnson's European Union divorce bill faces two votes Tuesday, with lawmakers first being asked to approve it in principle, followed by a vote on the government's schedule for debate and possible amendments. (House of Commons/via AP)
Brexit leave the European Union supporters protest with placards outside the Houses of Parliament in London, Tuesday, Oct. 22, 2019. British Prime Minister Boris Johnson's European Union divorce bill faces two votes Tuesday, with lawmakers first being asked to approve it in principle, followed by a vote on the government's schedule for debate and possible amendments. (AP Photo/Matt Dunham)