LONDON — Britain’s Parliament voted narrowly on Wednesday to demand a decisive say over the country’s plans to withdraw from the European Union, dealing an unexpected defeat to Prime Minister Theresa May, who had asked for maximum leeway to negotiate with Brussels on untangling decades of integration with the Continent.

Rebel lawmakers from the governing Conservative Party joined with pro-European members of opposition parties to require that any final deal to withdraw from the European Union be submitted to Parliament — as legislation — before it can be put into effect.

Mrs. May had argued that going through such formal approval would add yet another hurdle to the already contentious and protracted negotiation over withdrawal — a process, known as Brexit, that is supposed to be completed by March 2019.

She had promised that lawmakers would get a vote eventually, but the lawmakers effectively refused to take her word for it, insisting by a formal vote — 309 to 305 — on their explicit right to approve any final deal.