LONDON — Parliament was given a green light Tuesday to mount an effort to stop Britain from leaving the European Union without an agreement, in a high-pressure showdown with only a few weeks time for Parliament to act before the Brexit deadline.

In an important procedural ruling, John Bercow, the speaker of the House of Commons, agreed to allow lawmakers to try to seize control of the legislative agenda in Parliament, an area that is normally the preserve of the government.

[Update: Boris Johnson loses Brexit vote, as Parliament rebels.]

The decision clears the way for a two-step process in which lawmakers will vote tonight on whether to wrest control from the government and then vote again tomorrow on whether to force Prime Minister Boris Johnson to seek an extension to the Oct. 31 withdrawal deadline if he fails to reach an exit agreement with the European Union.

The critical vote is the first, on the procedural measure to gain control over the agenda. If Mr. Johnson’s opponents have the votes to do that, it is considered virtually certain they will have the votes to approve the measure heading off a no-deal Brexit.