As it loses steam in the polls, Poland's right-wing populist government is playing the anti-immigration card that helped it win in 2015, hoping to take back the political initiative, analysts said.

Thousands of migrants -- most of them from the Middle East -- have crossed from Belarus into eastern EU states, including Poland, in recent months.

The EU suspects the influx is engineered by the Belarusian regime in retaliation against increasingly stringent EU sanctions, with Poland the Baltic states calling it a "hybrid attack".

Political attention in Poland in recent weeks has focused on a group of around 30 migrants camped out on the border between Poland and Belarus.

Poland is refusing to let in a group of around 30 migrants camped out on the border with Belarus
Poland is refusing to let in a group of around 30 migrants camped out on the border with Belarus AFP / Jaap Arriens

Poland is refusing to let in the migrants, said to be Afghans by a charity trying to help them, or give them aid without the consent of Belarus.

"It cannot be ruled out that there will be early elections next year... and it is by no means certain that the Law and Justice (PiS) party will win a majority or manage to piece together a coalition," said Agata Szczesniak, a political analyst for the news portal OKO.press.

The government lost its formal parliamentary majority earlier this month after the departure of a junior coalition partner.

A recent poll by Kantar also found that PiS had fallen by three points in the polls and is now neck-and-neck with the main opposition grouping, Civic Platform, at 26 percent.

"To go back up in the polls, PiS is trying to replay what happened in 2015 but even more so. It is focusing public emotion around the image and rhetoric of a war" against migrants, Szczesniak said.

Thousands of migrants have crossed from Belarus into eastern EU states, including Poland, in recent months
Thousands of migrants have crossed from Belarus into eastern EU states, including Poland, in recent months AFP / Wojtek RADWANSKI

During Europe's migration crisis of 2015, PiS leader Jaroslaw Kaczynski scored electoral points in parliamentary elections that year with his anti-immigration rhetoric, including warnings about the diseases and "all sorts of parasites" that the migrants might bring with them.

The government has remained intransigent over the migrants on the border even after multiple appeals from the UN refugee agency, the Council of Europe and the European Court of Human Rights.

Prime Minister Mateusz Morawiecki has said he is protecting "holy Polish territory".

Many Poles sympathise with Afghans and are growing used to higher levels of immigration in the country
Many Poles sympathise with Afghans and are growing used to higher levels of immigration in the country AFP / Wojtek RADWANSKI

Dressed in military-style wear, he has visited the border to announce the building of a fence.

Culture Minister Piotr Glinski has promised to "defend Poland against migrants" and Defence Minister Mariusz Blaszczak has sent 2,000 soldiers to the border.

"What is happening at the border is political gold" for the government, said former EU chief Donald Tusk, now head of Civic Platform.

Adam Szostkiewicz, a political commentator for the weekly Polityka, said the government was "building its election campaign around this".

But analysts pointed out that public feeling around the issue has changed in recent years.

Many Poles sympathise with Afghans and are growing used to higher levels of immigration in the country, particularly of Ukrainians and Belarusians.

"At the time, around 70 percent of Poles said they were opposed to letting in refugees. Today, it is 55 percent," said Szczesniak.

The government may also be sending a mixed message.

In recent days, it has also evacuated almost 1,000 Afghans who worked for Poland's military contingent.

"On the one hand, the PiS is helping Afghans and on the other it is rejecting them. This creates confusion," said Szczesniak.

Szostkiewicz said the fact that the crisis could be orchestrated by Minsk "does not justify the lack of basic empathy... and Poles can see that".

The situation of the group blocked at the border has also prompted pleas from Poland's Catholic Church, which is traditionally close to the current government.

Poland's leading Catholic clergyman, Archbishop Wojciech Polak, has appealed for political leaders "to be guided above all by the spirit of hospitality, respect for new arrivals and goodwill".