WARSAW — Poland’s populist ruling party appeared to have swept back into power on Sunday, as voters dismissed concerns about the autocratic drift of the government and rewarded the party for its generous social welfare programs.

The Law and Justice party secured its mandate, according to early returns, by promoting a brand of aggrieved nationalism that resonated in the country’s rural heartland and the towns in the east of the country that have not kept pace with wealthier cities in the west.

Jaroslaw Kaczynski, the party’s leader and the chief architect of its policies, noted the deep divisions in the country even as he promised to continue reshaping the nation in fundamental ways.

“We have reasons to be happy,” he told supporters Sunday night after the polls closed. “The good change will continue. But we will need to reflect upon the things that we have done right as well as the things at which we have failed, because a significant portion of the society does not support us.”