WARSAW — The mayor of Gdansk, Poland, a leading liberal critic of the populist, right-wing national government, died on Monday after being stabbed at a public charity concert Sunday night, the minister of health told reporters.

Mayor Pawel Adamowicz, 53, the mayor of the northern port city since 1998, was known as a supporter of gay rights, and he had campaigned for the rights of immigrants in a country whose governing party has leaned heavily on anti-immigrant rhetoric.

“It was impossible to win against everything that had happened to him,” Lukasz Szumowski, the health minister, said of the stabbing. “God rest his soul.”

The attack stunned a nation that is increasingly divided politically. Tens of thousands of Poles joined rallies all over the country on Monday evening to condemn violence and hate speech.