The House of Commons on Wednesday passed a bill to prevent Prime Minister Boris Johnson from taking Britain out of the European Union without a deal on Oct. 31 and voted down his attempts to hold a general election ahead of the deadline.

The lower house passed a bill by a majority of 28 which will force the government to ask the European Union, by Oct. 19 at the latest, for a delay to Brexit until Jan. 31 if no agreement has been reached and parliamentarians have not agreed to a no-deal exit.

It was backed by opposition politicians and around 20 rebels in Johnson's own party who argued that leaving without a deal should be ruled out as it would cause significant economic harm.

With the latest development, Johnson has suffered two major defeats by legislators over his plans to push ahead with the departure from the bloc even under a potential "hard" Brexit.

The bill will now go to the House of Lords where it is expected to get approval by Monday.

Johnson, who heads the ruling center-right Conservative party, says Britain will leave the European Union at the end of October "with or without" a deal.

He branded the bill a "surrender" that will "scupper" negotiations with Brussels and says he will refuse to seek an extension to the talks.

Related coverage:

Japan's Kono asks new U.K. foreign secretary for orderly Brexit

U.K. hopes to build on EU-Japan deal after Brexit: Fox

Given this, Johnson proposed a motion to hold a general election on Oct. 15, so he could secure a working majority and restart negotiations with Brussels. The prime minister was confident he could get an improved deal with Brussels as long as Britain could credibly threaten to walk away from the talks at the end of October.

However, the opposition failed to back Johnson's request for a general election because they fear his party will seek to overturn the bill preventing a no-deal Brexit.

They argue they have had to rule out no-deal by legislation because Johnson has failed to make any progress in talks with Brussels. The European Union says the Withdrawal Agreement is not up for renegotiation.

Britain was originally due to leave the European Union in March, but the date was pushed back to Oct. 31.

Many countries including Japan have voiced concern about Britain exiting the European Union without a deal to limit potential negative impacts on the economy.

The Japanese government has warned on numerous occasions against a "hard" Brexit, given the country's large enterprises in Britain that benefit from frictionless trade with the European Union.

The Withdrawal Agreement, negotiated by Johnson's predecessor Theresa May, was rejected three times by Parliament, principally over the Irish "backstop" which would put Britain in a permanent customs union until alternatives could be found to maintain a soft border.

Johnson is calling for a new treaty with Brussels which would see the backstop taken out and a framework for a future free trade agreement.

Britain voted by a 52-48 percent majority to leave the European Union in June 2016.