Viktor Orban has been hit with his biggest political setback in a decade, after his right-wing nationalist party lost control of the country's capital.
Fidesz lost both the Budapest city council and mayoralty in elections on Sunday to Gergely Karácsony, a 44-year-old liberal who was backed by the main opposition parties.
Mr Karácsony beat István Tarlós, an ally of Mr Orbán, by 50 per cent to 44 per cent, according to preliminary results. His list also won 14 of the 23 districts on the city council, giving him a majority with which to govern the metropolis.
The victory in the capital race came after socialists, greens, liberals, and conservatives put aide their differences to field a joint candidate in the race.
The vote was seen as a test of the new strategy, which could adapted for the national level in future elections.
Mr Orban has dominated Hungarian politics in recent decades, and began his second term as prime minister in 2010 after a spell out of office.
In power he has picked fights with Brussels and said that he wants to end liberal democracy, while pushing anti-migrant and anti-minority policies and campaigns.
He has also centralised power around himself, with the country's media ecosystem mostly supportive of the government and opposition voices marginalised.
“We will take the city from the 20th century to the 21st,” Mr Karácsony said. "Budapest will be green and free, we will bring it back to Europe.”
Ahead of the vote the mayor-elect had likened Budapest to Istanbul, which voted against the candidate of Turkish president Recep Tayyip Erdoğan – another dominant strongman.
“Istanbul voted against an aggressive illiberal power in many ways similar to Orbán’s regime,” Mr Karácsony had said.
He said that the victory was "the first step on the road to changing Hungary".
Following the vote, Mr Orbán told supporters at a rally: “We acknowledge this decision in Budapest, and stand ready to cooperate."