Poland and Hungary have both claimed their votes were crucial to the election of new EU Commission president Ursula von der Leyen, in the hope of getting benefits from the new executive.

Poland's prime minister Mateusz Morawiecki told reporters on Tuesday (16 July) evening von der Leyen was a compromise candidate.

Student or retired? Then this plan is for you.

"I am a cautious optimist. The president of the European commission gives hope for a new opening," he said, a few hours after the German was approved by a wafer-thin margin of nine MEPs on Tuesday evening.

The female conservative politician was backed by 383 members of the European Parliament, in a secret ballot, with 327 against and 22 abstentions.

Poland's ruling party, Law and Justice (PiS) has 26 MEPs, while Hungary's Fidesz has 13.

Conservative PiS performed a U-turn after initially refusing to support von der Leyen, after their MEP, former prime minister Beata Szydlo was voted down as chair of the employment committee of the parliament - by liberal and socialist MEPs.

The PiS, however, blamed the centre-right European People's Party (EPP), from where von der Leyen hails.

Germany's Christian Democratic party (CDU) secretary-general Paul Ziemiak met on Sunday in Warsaw with PiS party leader Jaroslaw Kaczynski, and then Morawiecki and German chancellor Angela Merkel had a phone conversation on Tuesday.

Morawiecki said he told Merkel and von der Leyen about his "dissatisfaction with breaking EU norms and standards", when Szydlo was not given the chair position even though parliamentary rules allow for PiS to get the post.

'Say thanks'

He said PiS MEPs votes had been "decisive" for von der Leyen.

"You can say that thanks to us, there is no chaos, because the whole puzzle regarding top positions would be crumbling. We have turned out to be those who have kept up the stability," MEP Ryszard Legutko told the Polish news agency.

PiS politicians expressed their hope that Poland would get a strong portfolio in the next commission in exchange for their votes.

"We showed our effectiveness and the fact that we are in favour of a Europe of normality," Morawiecki said in a tweet - suggesting Poland's support for von der Leyen should also translate over to the negotiations over the EU's long-term budget.

The Polish PM added that with the new commission chief, Poland could come to a common position on security, energy and climate issues.

Poland and Hungary both have ongoing rule of law procedures against them, and had clashed with the commission led by outgoing president Jean-Claude Juncker over judicial independence and backlisting on democratic norms.

Hungary's government also suggested Budapest was looking to cash in on their votes from von der Leyen.

"In curbing migration, the new European commission president will also have to play a leading role in establishing stronger European borders and developing a culture where the states that undertake vast border protection efforts are rewarded rather than punished," Hungarian state secretary Zoltan Kovacs wrote in a blog post on Wednesday.

'Not unconditional'

"Ursula von der Leyen prevailed by only a thin margin, one that she wouldn't have had without the support of Fidesz-KDNP and, of course, prime minister Viktor Orban," he added, referring to the ruling government coalition.

"But Hungary's ongoing support is not unconditional: we have definite expectations of the new EC president and we will look out for the interests of the Hungarian people every step of the way," Kovacs wrote.

Poland is eyeing for the energy portfolio in the commission, while Hungary is reportedly bidding for the enlargement profile, something it fought for five years ago as well.

Milan Nic, a senior fellow at the German Council on Foreign Relations, told EUobserver that most of the boasting by Warsaw and Budapest is for the domestic audience.

He pointed out that the Polish and Italian PM both supported von der Leyen in the European Council, so their parties had an obligation to enforce the decision of their leaders.

Nic said von der Leyen could offer portfolios to Warsaw, but Poland should not expect the new commission chief to be backing down on rule of law issues.

Von der Leyen will be under the "highest scrutiny from the very beginning" on rule of law, precisely because of the strong opposition from Poland and Hungary to Dutch lead candidate and commission vice president Frans Timmermans for the top job.

Daniel Hegedus, a fellow with the German Marshall Fund told EUobserver that Poland and Hungary should not expect special treatment, as von der Leyen's victory was not only down to those two countries.

"I would not expect short term gestures towards Warsaw and Budapest, the EU budget negotiations and commission portfolios would be priority for these countries, but could not expect an easing of pressure on rule of law from von der Leyen," he added.