WARSAW — Under intense political pressure and the threat of legal sanctions, George Soros’s Open Society Foundations said on Tuesday that it had become impossible to work in Hungary, whose prime minister has blamed Mr. Soros for the country’s problems, and that the foundations would move their operations to Berlin.
The foundations, which promote democracy, free expression and civil rights, have come under growing political and legal pressure from Prime Minister Viktor Orban, who has stifled dissent and declared last week that “the era of liberal democracy is over.” The foundations have been a frequent target of the Hungarian government, and Mr. Orban himself has painted Mr. Soros as a shadowy figure seeking to undermine the country’s sovereignty.
“The government of Hungary has denigrated and misrepresented our work and repressed civil society for the sake of political gain, using tactics unprecedented in the history of the European Union,” Patrick Gaspard, president of the foundations, said on Tuesday.
The decision to close the groups’ offices in the country of Mr. Soros’s birth — they will continue to operate in many other countries — is the grim culmination of years of struggle to work in an increasingly hostile environment. Mr. Soros, 87, a Jew who survived the Nazi occupation of Budapest during World War II, later made a fortune in the financial markets, and he created the foundations and donated billions of dollars to them.
Mr. Orban campaigned on a nationalist, anti-immigrant platform, and vowed during the most recent campaign to seek revenge against those he deemed enemies of the state. He has proposed what is commonly referred to as a “Stop Soros” law, aimed at penalizing nongovernmental agencies that assist asylum seekers and refugees.
The legislation, as it was written before the election, would force aid agencies working with migrants to apply for and receive national security clearance from the Interior Ministry. Additionally, groups receiving foreign funding — which includes almost all of the major nongovernmental organizations in the country — would have to pay a 25 percent tax on those contributions, a burden that many said would make it impossible to keep working in Hungary.
On Monday, Antal Rogan, the minister for Mr. Orban’s cabinet office, said the government would propose an even “tighter” Stop Soros bill, but he provided no details. The legislation is likely to come up for a vote within the next month.
Mr. Orban’s party, Fidesz, along with a smaller coalition partner, holds two-thirds of the seats in Parliament, and can probably pass whatever legislation it sees fit — including changes to the Constitution.
Leaders of the Open Society said that even without the approval of the law, being based in the country had become untenable.
“It has become impossible to protect the security of our operations and our staff in Hungary from arbitrary government interference,” Mr. Gaspard said.
But the groups’ leaders vowed to continue to promote civil society in Hungary.
Central European University in Budapest, another institution that was founded and funded by Mr. Soros, remains in a state of limbo. Under current law, it cannot accept new students after January 2019; if it cannot reach a compromise with the government, it may also be forced to leave the country.
Mr. Soros has spent hundreds of millions of dollars in Hungary to promote political freedom, beginning when it was under one-party Communist rule. The foundations have worked in the country since 1984.
In 1988, as the grip of the Soviet Union began to weaken, one of those who appealed to the Soros organization for funding was a young firebrand named Viktor Orban. He wanted money to study grass-roots democracy and how nations transition from dictatorships to democracies.
“One of the main elements of this transition can be the rebirth of civil society,” he wrote at the time.
That past connection makes the current moment that much more remarkable.
Three decades later, civil society groups and Western officials have accused Mr. Orban of undermining the basic tenets of democracy in order to tighten his own grip on power and create a one-party state. The European Union has even threatened to cut aid to Hungary and Poland over their drift toward autocratic rule.
Mr. Orban has held onto power in large part by focusing on a single issue: the migration crisis that reached its peak in 2015. He has framed the issue as a battle for the survival of the nation, where migrants, many of them Muslims, will subvert the country’s Christian traditions.
It hardly seemed to matter during the campaign that few migrants are seeking to transit through Hungary. Mr. Orban successfully used the issue to accuse officials in Brussels and other Western leaders of seeking to undermine Hungary’s sovereignty.
No figure featured more prominently in the campaign than Mr. Soros.
His image appeared on tens of thousands of posters plastered around the country, often edited to make it appear — falsely — that he and leading opposition candidates were holding fence-cutting equipment, ready to throw open the nation’s borders.
In a statement, the foundations said the government had spent “more than 100 million euros” on a propaganda campaign against the group, including “invoking anti-Semitic imagery from World War II.”
Mr. Soros, who lives in New York City, has denied as absurd the allegations leveled against him.
As Mr. Orban’s rhetoric and the personal attacks intensified, Mr. Soros struck back in a 2017 speech about European integration.
At the time, he said he was “full of admiration for the courageous way the Hungarian people have resisted the deception and corruption of the mafia state the Orban regime has established.”
But on Tuesday, the roughly 100 employees of the foundations started packing up their offices.