The leader of Poland's ruling party Law and Justice (PiS), Jaroslaw Kaczynski | Janek Skarzynski/AFP via Getty Images Elections pose big test for Poland’s rulers — and their critics Local polls set stage for European and parliamentary votes next year.

WARSAW — Poland's local elections this Sunday are a crucial test for both the ruling Law and Justice (PiS) party and its opponents.

It's the first vote since 2015, when the nationalist-conservative party first took the presidency and then swept to power with an absolute parliamentary majority. Sunday's outcome is being touted as a referendum on the sweeping changes — and deep conflicts — brought about by Law and Justice, and a gauge of whether the opposition — mainly the former ruling Civic Platform (PO) party — is a realistic alternative.

It also sets off a heated campaign season, with the European election in May followed by a parliamentary election in the fall and a vote for president in 2020.

Since winning power in 2015, PiS has introduced a highly popular universal subsidy for families with more than one child and lowered the retirement age. It has also unleashed a conflict with the European Union over deep reforms to the judicial system that the government says are needed to get rid of the corrupt vestiges of communist times, while Brussels contends the changes undermine the rule of law.

The European Court of Justice made a dramatic intervention into the battle over the legal changes on Friday, ordering Warsaw to suspend immediately its overhaul of Poland's Supreme Court.

The government's reform program — which it calls "Good Change" — coupled with its policy of boosting national pride and its refusal to accept a single refugee under the now defunct EU migrant redistribution quotas system, have kept Law and Justice high in opinion polls, well ahead of Civic Platform and smaller opposition groupings. An opinion poll published this week by the Kantar organization found PiS has the support of 31 percent of voters, while an opposition coalition led by PO has 24 percent.

Although Sunday's elections will be seen as a test for next year's national votes, they are tricky terrain for the parties because of their mix of local and national issues and personalities.

"These elections, if taken together, will decide whether the 'Good Change' will continue in Poland and, even more, if it will be deepened," PiS leader Jarosław Kaczyński told a party rally this week.

PiS has tended to punch well below its weight in regional elections. In 2014, it won six of the country's 16 regions, but only governs in one because other parties formed coalitions to keep them out of power. A similar outcome is expected this year, and the party's effort to win half the regions is likely to fall well short of that goal.

According to a projection by the news portal oko.press, PiS may win a plurality of seats in 10 regions, but stands a chance of governing in only seven.

The party also has only 11 mayors in Poland's largest 107 cities, which tend to be more liberal than the conservative small towns and countryside where PiS finds much of its support.

According to a compilation of opinion polls from the 22 largest Polish cities, published on Tuesday by oko.press, PiS is ahead in only one race.

In an interview for the Polsat TV channel on Wednesday, Kaczyński admitted that PiS doesn't have high chances of taking many big cities, saying: "We want to win in as many regional parliaments as possible."

Battle for Warsaw

The highest profile mayoral race, and the one with the biggest political consequences, is in the capital Warsaw, also the country's largest city.

The PO candidate Rafał Trzaskowski has an edge of more than 10 percentage points over his PiS rival Patryk Jaki, and is the favorite to win. However, Jaki has run an aggressive and energetic campaign — boosted by full-throated support from the state-controlled media — while Trzaskowski has been criticized for a lackluster effort.

An upset by Jaki in Warsaw (there is a second round of voting on November 4 for candidates who fail to win an absolute majority) would be a stunning defeat for PO leader Grzegorz Schetyna and a signal that the party faces a drubbing next year.

The two leading parties have led very different campaigns. PiS initially focused on good governance, with Kaczyński and Prime Minister Mateusz Morawiecki heading off around the country to launch construction projects. But with polls showing a tightening in recent days, the party has returned to its nationalist roots.

On Wednesday, Law and Justice ran a political ad criticizing PO for its support for admitting a limited number of migrants. The footage showed graphic pictures of street violence that the voiceover says could happen if Muslim refugees are allowed to enter Polish cities. However, even the normally pro-PiS Catholic Church recoiled at the ad, and the effort may end up boosting support for the opposition.

Civic Platform has accused PiS of undermining democracy and attacked the ruling party for its conflicts with the EU, warning that such policies will eventually lead Poland out of the European Union.

"We will not allow the kind of politics that we see today at the highest levels of government to reach local governments," Schetyna told a campaign rally in the northwestern town of Piła on Wednesday. "We will win these elections, and in a year we will win the parliamentary elections."

This article has been updated.