Romania's government, in trying to soften anti-corruption laws, is fanning the flames of nationalism by criticizing the presence of foreigners at protests, according to experts and politicians.

Officials also have been challenging the role of the European Union in the corruption fight, and suggesting it is time to put Romania first.

The anti-foreigner tone of pro-government forces, including the ruling Social Democratic Party, suggests a backlash to Romania's enthusiastic embrace of the outside world that followed the fall of hard-line communism in 1989. But major street protests have for the moment stalled the drive to ease penalties for graft.

The rhetoric, though muted, is bringing Romania somewhat closer to Hungary and Poland, which have taken a much harsher approach since the election of right-wing leaders unhappy with Europe's open borders, experts say.

"The Social Democratic Party pigmented its electoral rhetoric with nationalist rhetoric, against the EU, against corporations," said Stelian Tanase, a political scientist. "The message is still soft not like in Hungary. Let's see how it develop in the next two or three years."

He said the ruling Social Democratic Party wasn't a modern center-left political group, but had a conservative edge and was influenced by international political developments.

"This is a European trend — look at Poland, Hungary, Brexit. Look at Trump. It's a message that catches on."

Cristian Parvulecsu, dean of the National School of Political Studies and Public Administration, said some members of Romania's ruling Social Democratic Party are promoting values favored by Russian President Vladimir Putin and Hungarian Prime Minister Viktor Orban, known for his anti-refugee stance.

"It is an insidious campaign to influence public opinion," he said, citing an "anti-European attitude" promoted by some members of the ruling Social Democratic Party, and the demonization of some non-governmental organizations.

Official criticism of the European Union's role is raising questions about the country's commitment to the EU at a time when Britain is leaving the 28-nation bloc and far-right leaders opposed to the EU are gaining ground before vital elections in France, Germany and the Netherlands.

The nationalist current flies in the face of traditional Romanian hospitality and the warm welcome foreigners often receive.

A week before the protests broke out, powerful Social Democratic Party chairman Liviu Dragnea, who faces corruption charges that block his route to becoming prime minister, told Romanian television that financial checks should be carried out on NGOs operating in Romania because some that receive public money may not be operating lawfully.

He singled out philanthropist and financier George Soros, who has donated hundreds of millions of dollars to promote democracy in the former Soviet bloc, for criticism.

"This person and the foundations and structures he set up years ago ... financed what was bad in Romania, financed actions not one of which did Romania any good," Dragnea said on Romanian TV.

Once the protests started, Dragnea complained that foreigners were taking part. He specifically cited the presence of a prominent international banker.

"It seemed more than wrong for the chairman of a foreign bank, a foreign citizen to protest against the government," he told Romanian TV. "Of course he's upset about a banking law we passed."

In response, Dutch national Steven van Groningen, chairman of Raiffeisen Bank and the Council of Foreign Investors, said it was legitimate for him to join the demonstrations.

"My presence at the protests was a personal decision," he said. "Before being a bank chairman, I am a father and I care about the future of my children and the country they live in. Just like people I met there, clients, friends, business partners, entrepreneurs, athletes and an Olympic champion ... I want a better future for my children."

Romania joined the EU in 2007 in what was seen as a triumph for its post-communist modernization drive. Now, the EU is coming under fire for backing Romania's robust anti-corruption unit, which is making a spirited effort to curtail the widespread graft that has for decades been a feature of national life.

Senate Speaker Calin Popescu Tariceanu, a close ally of Dragnea, said the anti-corruption unit has abused its authority and infringed on individual rights — with backing from the EU and its representatives in Romania.

Tariceanu, a former prime minister who now heads the junior party in the governing coalition, said that EU diplomats have closed their eyes to prosecutorial abuses that wouldn't be tolerated elsewhere "because it allows the EU to say, 'Look Sir, we had an experiment in Romania and it succeeded. "'

He said that Romania should be a "sovereign" country in charge of its own affairs — an argument familiar to Britons who heard it repeatedly from proponents of the successful campaign to take Britain out of the EU in a June referendum.

Tariceanu maintains, however, that he is committed to EU membership and isn't advocating what is known locally as "Romexit" — a Romanian exit from the bloc.

President Klaus Iohannis, who opposes the weakening of anti-corruption statutes sought by the ruling party, said he isn't alarmed by the nationalistic trend because it hasn't become virulent.

"It's not something that is worrying us," he told The Associated Press. "Everywhere you have politicians who promote nationalism. This is not extreme and it does not go against the essence of democracy."

"Talking about it is not damaging. Not talking about it, and having ultra-nationalist parties coming up, that would be a danger."