London — Conditions seemed ripe for a resurgence of Britain’s political middle when the country learned seven weeks ago that it would return to the polls in a snap election, which took place on Thursday.

The spirited bid of the Liberal Democrats, a center-left party punished two years ago for joining a coalition with the Conservatives, had resonance but did not produce a major realignment, owing to the foibles of its leader, the peculiarities of the British electoral system and the decisive — if highly contested — choice of voters last year to leave the European Union. The party, which saw its representation in Parliament fall to eight seats in 2015, was poised to gain modest influence but not greatly fortify its position, according to an exit poll released late Thursday.

The prospect that the Conservatives might fail to capture a majority, as Labour support appeared to surge, put the Liberal Democrats in a potential kingmaker position. But the party has said it will not join a coalition.

Its difficulty gaining ground, despite apparent advantages, offers a case study of how political alternatives wither even as distrust for politics as usual mounts.

A special election win in December, in a district that had heavily favored remaining in the European bloc, seemed to offer a blueprint for the party’s return to prominence. A redo referendum was at the heart of its manifesto. The two leading parties, the ruling Conservatives and the opposition Labour Party, had moved to the extremes, reflecting — or magnifying — the polarization of public opinion. Neither has offered a comfortable home for those who believe the country is doing itself harm by cutting ties with Europe. Nearly half the country feels this way, according to Pew data.

Trends beyond Britain were encouraging, too. Globally, dissatisfaction with mainstream politicians was soaring. Across the English Channel, a pro-European centrist, Emmanuel Macron, rose to the presidency from relative political obscurity, under the banner of a new party.

“We look to France and indeed to Canada and see anything is possible,” said Tim Farron, the Liberal leader, in an interview during a campaign stop in Twickenham, a leafy suburb of London.

As he barnstormed the country the day before the polls opened, Farron made his final case that “there’s got to be a better way forward than the simplistic, easy answers of the hard left and the cruel, mean narrowness of the Conservative government.”

“The space for the Liberal Democrats is huge,” he said.