Polish Prime Minister Beata Szydło and Hungarian Prime Minister Victor Orbán at a joint news conference in Warsaw | Jacek Turczyk/EPA Poland and Hungary stand united (except on Russia) Budapest sees Kremlin as an ally, Warsaw sees it as a threat — but that doesn’t spoil their common front on Brussels.

BUDAPEST — Poland and Hungary are teaming up in their fight against Brussels, even though they are divided on how precisely to approach dealings with the EU and on other major foreign policy matters.

Hungarian Prime Minister Viktor Orbán met Poland's Beata Szydło in Warsaw on Friday, just ahead of a meeting of European affairs ministers on September 25, where Poland’s rule-of-law row with Brussels is on the agenda. EU leaders are also expected to discuss Hungary and Poland at their summit next month.

“What's happening to Poland now in the EU is a lack of respect,” Orbán said in a joint news conference with Szydło. “Criticism about Poland not observing the rule of law is groundless,” he said, calling Poland and Hungary “guardians” of the foundations of the EU.

Both countries face multiple EU infringement proceedings, and have repeatedly indicated that they will not take in any asylum seekers, rejecting the Commission's quota system for migrants.

Earlier this month, the European Court of Justice dismissed a challenge by Slovakia and Hungary against the EU’s relocation policy for asylum seekers, upholding the EU’s right to oblige member countries to take in refugees.

“We acknowledge the verdict of the European court,” Szydło told the news conference, while noting that during the meeting the Polish and Hungarian sides confirmed their joint position on migration and that her government will prioritize the safety of Polish citizens.

In May, the European Parliament called for the triggering of Article 7 against Hungary, a procedure which has never been used before and could in theory lead to it losing its voting rights in the EU.

Poland is under scrutiny for its controversial judicial reforms and the European Commission is considering launching Article 7 proceedings against Warsaw, though Orbán has pledged to veto any such move against his Polish friends.

“Our politicians are very careful because they need Orbán for their battles with the European Commission,” said a Polish government official, who spoke on condition of anonymity.

“It’s good for the Polish government to cooperate with Orbán for domestic reasons, because some of the Polish right wing admires him,” said the Polish official.

Piotr Buras, who heads the European Council on Foreign Relations’ Warsaw office, said the two countries share a similar “illiberal democracy model.”

“What brings them together is in fact something more ideological than political, it’s an opposition to the West European model of society, culture, and politics,” he said.

At the same time, they are increasingly at risk of being isolated within Europe.

“The Visegrad Four is more and more turning into a Visegrad Two group, where the Czechs and Slovaks are the more open partners, while the Hungarians and Poles are considered EU renegades,” said Hungarian opposition politician Bernadett Szél, who serves as co-chair of the Politics Can Be Different (LMP) party.

But while Hungary and Poland are united in their opposition to criticism from Brussels, they differ greatly in other foreign policy priorities.

While Hungary maintains close ties to the Kremlin, Warsaw sees Russia as a security threat and prioritizes boosting defense and promoting energy independence from Russia — aims that the government in Budapest does not share.

“We understand Hungary judges Russia and Russian actions from its own perspective,” the Polish foreign ministry said in a written statement. “What’s most important is that despite some differences regarding Russia's aggressive policy in Ukraine, Poland and Hungary are standing shoulder-to-shoulder on EU sanctions imposed on Moscow.”

Members of Poland’s ruling Law and Justice party (PiS) insist Budapest’s relationship with the Kremlin is not a hurdle.

“Differences between Warsaw and Budapest on Russia will not have an impact on our joint actions with regard to the EU,” said Polish MEP Ryszard Czarnecki, a member of PiS. “Prime Minister Orbán is talking with Mr. Kaczyński and Prime Minister Szydło about coordination of these actions.”

“Orbán is much more pragmatic when it comes to intra-European relations, he has a much better network in Europe than [PiS leader Jarosław] Kaczyński" -- Piotr Buras

This view is echoed in Budapest, where officials emphasize the role of the Visegrad Group.

“The basis of our long-standing cooperation has always been mutual trust, a similar historical and cultural background and a pragmatic focus on those issues where we can, at least partially, agree,” said Krisztina Varju, ministerial commissioner for the Hungarian presidency of the Visegrad Group, in a written statement to POLITICO.

“We seek respect, acceptance and equality within all debates that concern us within the EU, including those about migration and the EU’s future,” she wrote.

But despite Hungary’s combative rhetoric toward Brussels and public commitment to defending Poland, Budapest ultimately appears more flexible and open to solutions than Warsaw.

“Orbán is much more pragmatic when it comes to intra-European relations, he has a much better network in Europe than [PiS leader Jarosław] Kaczyński,” said Buras of the ECFR.

“At the European level, [Orbán] is less ideological than Kaczyński. Kaczyński really believes in what he says,” he said, while Hungary “is more inclined to engage in compromises.”

Michał Broniatowski contributed reporting from Warsaw.