Hungary's ruling conservative Fidesz party has suffered a shock defeat in a mayoral election seen as a popularity test for Prime Minister Viktor Orban.
The southern town of Hodmezovasarhely was considered a Fidesz stronghold.
Peter Marki-Zay won with the backing of all main opposition parties. He got 57.5%, against 41.5% for Fidesz.
Hungary will hold national elections on 8 April, with Mr Orban seeking a third consecutive term. This setback for him is seen as nationally significant.
For years Fidesz has benefited from the fragmentation of opposition parties.
Mr Marki-Zay, a political novice who ran as an independent, said the result set an "example of revolt" and showed Fidesz could be defeated by joining forces and overcoming apathy.
It was a signal that "we want to get rid of the big boys bullying the whole class", he added.
Mr Orban is in dispute with the European Union over his refusal to take in migrants - defying a relocation scheme - and constitutional changes which critics say undermine human rights.
He argues that his changes are necessary to purge Hungary of communist-era networks, curb "foreign" liberalism and restore the authority of Christianity and the family.
Read more on EU-Hungary tensions:
Finally a possibility of beating Fidesz
By Nick Thorpe, BBC Budapest correspondent
The result is a massive shock for Fidesz and a great boost for opposition parties.
Opinion polls suggested that the general election would be won easily by Fidesz. Now the very diverse opposition see the chance not just to survive the election, but to actually topple Fidesz. That would, however, assume a degree of co-operation and trust between them which has been largely lacking until now.
Voters in Hungary are asked to mark two squares on ballots: for the individual constituency, of which there are 106, and for party lists.
In the last election in 2014, Fidesz won 96 of the 106 individual constituencies, even though the combined opposition vote was 52%, compared to 44% for Fidesz.
If the opposition groups now agree to withdraw candidates in favour of the strongest anti-Fidesz figure, many former Fidesz bastions could fall to them. "The question now is how to beat the Fidesz government, not just how to stop them winning a two-thirds majority," said Robert Laszlo, an electoral specialist at the Political Capital think tank.
Zsolt Bayer, a radically pro-Fidesz analyst, likened the Hodmezovasarhely result to a horror film. His conclusion was that it must galvanise passive Fidesz voters to support the Orban government on election day.