The ruling party of Hungary's right-wing Prime Minister Viktor Orban has been suspended by the European Parliament's biggest grouping in a row over defiance of EU policies.
In an almost unanimous vote, the European People's Party (EPP) agreed to withdraw Fidesz's voting rights.
Before the vote, Fidesz officials had threatened to pull out of the EPP if it was suspended.
However, Mr Orban reacted defiantly, saying "we cannot be excluded".
Although the suspension stops short of complete expulsion, the decision comes as a blow for the Hungarian leader on the eve of an EU summit.
After a heated debate and 190 votes in favour of suspension, the party decided to accept the result, with Mr Orban even suggesting that it was a "joint decision".
#Orban: what happened today was that we took a joint decision, we ourselves also voted for it. The EPP remains a broad party where there is place for liberals and for Christian Democrats— Zoltan Kovacs (@zoltanspox) March 20, 2019
But the penalties for Hungary's ruling leader are clear and immediate. He will not appear at a meeting on Thursday with other EPP leaders such as Germany's Angela Merkel and Austrian Chancellor Sebastian Kurz ahead of the summit.
"Practically it means that Fidesz cannot any more present candidates for posts in the party, they cannot vote any more for any kind of EPP assembly and they are even not any more allowed to participate in any meeting," said EPP leader Manfred Weber.
But the vote is also potentially bad news for the centre-right bloc, which faces European Parliament elections at the end of May. While the EPP is an alliance of about 80 parties, Fidesz has a two-thirds majority in the Hungarian parliament, making it the country's dominant political force.
The party will now be assessed by three "wise men" who will decide whether it is in breach of the centre-right bloc's values. The length of the suspension is unclear, but it will last beyond the European elections.
Why has Fidesz been suspended?
The final straw for many centre-right parties in Europe was an anti-immigration poster campaign that featured unflattering photos of European Commission President Jean-Claude Juncker and billionaire philanthropist George Soros.
Mr Soros is a regular target of Fidesz, which accuses him of encouraging illegal migration to Europe. Mr Soros funds civil society groups that help migrants or defend human rights. Critics see the attacks on Mr Soros - a Jewish survivor of the Nazi Holocaust in Hungary - as anti-Semitic.
For many right-wing, anti-immigration parties, Mr Orban is a hero for regularly castigating Brussels for its approach to migration, especially Muslim migration.
"We can be only be part of a parliamentary group that is clearly opposed to immigration and stands completely obligated to the defence of Christianity," Mr Orban said after the vote.
Is it just about posters?
No. Mr Orban has also dismissed his critics in the EPP as "useful idiots" - a phrase generally attributed to Soviet leader Vladimir Lenin, who was referring in the 1920s to naive Western admirers of his brand of socialism.
However, Mr Orban did appear to want to end the row last week when Manfred Weber visited Budapest in search of an apology.
The offending posters along Mr Weber's route were hastily papered over and Mr Orban sent apologetic letters to the 13 parties that had called for Fidesz to be kicked out.
But the wording of the apology was seen as grudging and the anti-EU ad campaign was still visible on Hungarian news websites after Mr Weber had left Budapest.
Mr Orban has also attacked the liberal consensus underpinning EU institutions, advocating instead a vigorous new Central European powerbase.
The European Parliament has launched a legal procedure against his government which could result in sanctions. EU partners accuse Fidesz of undermining democracy and the rule of law.
Why has Orban taken this on the chin?
By Nick Thorpe, Central Europe correspondent
To the dismay of radicals in his own party, and of a group of vociferous journalists in media close to Fidesz, Viktor Orban fought to keep his party in the EPP - for now.
This is a cold political calculation. The loss of its voting rights inside the EPP, and of the right to nominate candidates for EPP posts, was a small price to pay for continued membership.
It is also a decision taken with an eye on Fidesz supporters, who are largely pro-EU.
Many Fidesz voters fear that falling out of one European institution - the EPP - would be the first stumble on a slope which would lead to Hungary falling out of the European Union altogether.
Fidesz constantly follows public opinion with private surveys by its own think-tanks.
The timing of the vote was also very important - ahead of the May European Parliament elections. By staying in the EPP, he can continue to use the party as a platform for his anti-immigrant rhetoric.
If fellow anti-immigrant populists do well in May, he can quit the EPP and join them when he feels like it.
"It will be our decision whether we stay in or leave the EPP," he told the PestiSracok website.