BUDAPEST (Reuters) - Hungarian Prime Minister Viktor Orban said on Saturday that Budapest would defend Poland as the European Union threatens Warsaw with sanctions over its plans to extend government control over its courts.

Hungary’s Prime Minister Viktor Orban listens during a news conference in Budapest, Hungary, July 19, 2017. REUTERS/Bernadett Szabo

Poland is overhauling its supreme court despite street protests against the move and the threat of EU penalties.

“The inquisition offensive against Poland can never succeed because Hungary will use all legal options in the European Union to show solidarity with the Poles,” Orban said in an annual speech that was televised from Baile Tusnad, Romania, where he was attending a gathering of conservative leaders.

Like Polish leader Jaroslaw Kaczynski, Orban has locked horns with the EU for years over what Brussels sees as disrespect for democratic freedoms. Orban has increasingly posed as a freedom fighter against what he sees as EU overreach.

Orban, 54, is a runaway favorite to win a third straight term in an election in April 2018.

Calling for “patriotic governance” against the EU, he said Poland was a victim of harassment from Brussels, in the same way he said Hungary had been in its sights since he took power in 2010.

Citing a voter survey his government ordered in the EU’s 28 member states, he said European leaders were out of touch with the public on issues such as migration and said it had forced pro-migrant policies on eastern European nations.

“When a political elite turns against its people it always needs an inquisitor, who steps up against those who speak up,” he said, branding EU Commission Vice President Frans Timmermans as the inquisitor.

He said Timmermans was involved in an “effort to weaken patriotic governments”, adding Poland was now his target.

He said migration was now Europe’s main issue. “Will Europe be inhabited by Europeans? Will Hungary be inhabited by Hungarians, Germany by Germans, France by the French, Italy by Italians? Who will live in Europe?” he said.

He said Brussels was wrong to demand solidarity among EU states over issues such as a mandatory quota that aimed to spread hundreds of thousands of immigrants across the continent.

“We can never show solidarity with ideas and peoples whose goal is to change our lives. We cannot show solidarity or we risk losing our identity,” he said.

He said Martin Schulz, the former European Parliament president now seeking election as German chancellor, was “shameless” for demanding such solidarity.

Shulz, who has criticized Orban in the past, said countries which did not show solidarity should face financial sanctions. French President Emmanuel Macron has also said the EU was not a “supermarket”, and has said EU rules and values must be respected.

Orban said Hungary had spent about 260 billion forints ($1 billion) in recent years to deal with waves of migrants and said the EU had not offered compensation.

He said Hungary was also contributing to the EU’s success by providing German and other EU firms with cheap labor for their factories that have been set up in the east European nation.