If Mrs. May should find parliamentary opposition intolerable, she might ultimately be tempted to seek an early general election to gain a wider mandate for leaving the bloc, some analysts said. Currently, her Conservative Party holds a slim majority, with 329 seats in the 650-seat Parliament, and many of those members opposed a withdrawal.

The ruling unsettled the proponents of exiting the European Union, who warned against backsliding. Nigel Farage, who resigned as leader of the nationalist U.K. Independence Party after the referendum, said he feared that Britain was heading for a “half Brexit,” and he said he would return to politics in 2019 if the country had not left the bloc by then.

“I see M.P.s from all parties saying, ‘Oh well, actually we should stay part of the single market; we should continue with our daily financial contributions,’ ” he said in an interview on BBC Radio. “I think we could be at the beginning, with this ruling, of a process where there is a deliberate, willful attempt by our political class to betray 17.4 million voters.”

On Thursday, the government said that an expedited appeal would be heard in December by the Supreme Court, Britain’s highest appellate body, and that it was sticking to its timetable for leaving the bloc for now. Yet in the growing environment of constitutional, legal and political uncertainty, the government’s strategy could easily be disrupted.

The ruling was “a severe setback for Theresa May’s government,” said Mujtaba Rahman, managing director for Europe at the Eurasia Group, a political consulting firm. But he added that the government’s timetable could still be met if the Supreme Court ruled in its favor.