BUDAPEST, Hungary (AP) _ Hungary's right-wing nationalist prime minister, Viktor Orban, has for more than a decade nurtured close political and economic ties with Russia, giving him the reputation as the Kremlin's closest European Union ally.

For weeks, as Russian President Vladimir Putin amassed tens of thousands of troops along the borders of Ukraine, Hungary's neighbor to the east, Orban avoided condemning the buildup and spoke emphatically against applying sanctions.

As tensions escalated, Orban even traveled to Moscow, where he met with Putin in the Kremlin, their 12th official visit in as many years, and lobbied for larger shipments of Russian gas.

But when Russia's large-scale invasion commenced last week, Orban for the first time laid responsibility for the tensions and violence on Moscow in what could be a turning point in his more than decade-long, pro-Russia approach.

``Russia attacked Ukraine this morning with military force,'' Orban said hours after the invasion began Thursday. ``Together with our European Union and NATO allies, we condemn Russia's military action.''

Though Orban neglected to mention Putin by name, or to call the ``military action'' an invasion, his apparent about-face was long awaited by his critics both in the EU and in Hungary.

It could also be a sign that he realizes his posture toward Moscow is ``not rooted on stable fundaments,'' said Daniel Hegedus, a fellow for Central Europe at the German Marshall Fund.

``What we see is practically the collapse of Orban's 12-year-long Russia policy,'' Hegedus told the Associated Press. ``I think (Orban) realized that Russia is a security threat in the region.''

A formerly communist country that was dominated by the Soviet Union for more than 40 years, Hungary has historically deeply distrusted Moscow, which ordered the brutal repression of an anti-Soviet uprising in 1956 that led to thousands of civilian deaths and some 200,000 refugees fleeing the country.

As the communist system in Eastern Europe neared its end in 1989, Orban, then a 26-year-old anti-communist leading a movement of young liberal democrats, demanded the immediate withdrawal of Soviet troops from Hungary in a speech to several hundred thousand people on Budapest's Heroes' Square.

But in recent years, Orban _ whom critics accuse of increasingly authoritarian tactics since entering power in 2010 _ has pursued a diplomatic and economic strategy he calls ``Eastern Opening,'' a policy which advances closer ties with autocratic countries to Hungary's east amid what his government sees as Western decline.

As part of that strategy, Orban has initiated a 12 billion-euro ($13.6 billion) Russian-backed project to add two nuclear reactors to Hungary's only nuclear power plant, financed primarily by a Russian state bank.

His government has also increased Hungary's dependence on Russian natural gas, and in 2019 provided a headquarters in Budapest for the Moscow-based International Investment Bank (IIB), an institution with Soviet roots that critics say could be a conduit for Russian spying.

As the conflict between Russia and Ukraine escalates, Orban faces greater pressure than ever to choose between Moscow and Hungary's Western partners in the EU and NATO military alliance _ but is showing increasing signs that he may continue to straddle the line between the two.

The Czech Republic on Friday said it would pull out of the IIB to punish Russia for its invasion of Ukraine, and urged other members of the bank to do the same _ which, on Sunday, Hungary's neighbor Romania did.

Also on Friday, Polish prime minister and key Orban ally Mateusz Morawiecki warned in the Financial Times that Putin's aggression in Ukraine would extend to other parts of Eastern Europe if left unchecked, and urged Western countries to end the ``era of illusions`` about Russia.

``We are seeing that the price of European naivete over Russia is Ukrainian blood,'' Morawiecki wrote.

Speaking to journalists Saturday at Hungary's border with Ukraine, Orban said his country would support all proposed EU sanctions against Moscow, and acknowledged that Russia's invasion would likely cause changes in his relationship with Putin.

``Of course, we have to adjust everything,'' Orban said.

Yet as most EU countries have committed to sending military aid to Ukraine as it fends off the Russian assault, Hungary has remained firm in its resolve not to enter the conflict in material terms.

On Monday, Hungarian Foreign Minister Peter Szijjarto _ on whom Putin bestowed one of the highest Russian state honors last year _ announced that Hungary would not allow the transit of lethal arms bound for Ukraine on its territory.

And in a sign that old deals die hard even in times of war, Orban said in an interview with state television that Hungary's Russian-backed nuclear plant expansion and long-term gas contracts ``must be left out of the sanctions issue, because otherwise we will pay the price of the war, and nobody wants that.''

But there are some in Hungary who want just that. Hours after the Russian invasion began, several thousand demonstrators gathered in front of the Russian Embassy in Budapest to denounce the assault and demand that Orban abandon his ties with Putin.

Chanting ``Russians go home!'' _ a phrase popularized during Hungary's 1956 anti-Soviet uprising and echoed by Orban in his famous speech in 1989 _ protesters called for the ouster of the IIB from Budapest and the suspension of the nuclear plant expansion.

Peter Marki-Zay, an independent conservative who leads a six-party coalition seeking to defeat Orban's Fidesz party in April elections, criticized Orban for his ties with Putin, and demanded he take a clear stand on his commitment to the EU and NATO.

``Don't try to do business with Putin when it comes to our allies,'' Marki-Zay said.

Speaking at the protest, Anna Donath, an EU lawmaker and president of the opposition Momentum party, said that Orban had ``ignored the will of the Hungarian people'' to have a Western-style European democracy.

``For 12 years he has been making friends and doing business with Eastern dictatorships,'' Donath said.