WARSAW, POLAND—A convicted criminal with a knife rushed on to the stage during the finale of a charity event Sunday night and stabbed a Polish mayor in the heart and abdomen before shouting that he did it for political revenge, in an attack that left doctors fighting to save the politician’s life.

Gdansk Mayor Pawel Adamowicz grabbed his belly and collapsed in front of the audience at the “Lights to Heaven” fundraiser organized by the Great Orchestra of Christmas Charity, the country’s most important charity.

Doctors reanimated Adamowicz on the spot and then transported him to Medical University of Gdansk, where he underwent five hours of surgery, said Dr. Tomasz Stefaniak, one of the doctors treating Adamowicz.

Almost seven hours after the assault, Stefaniak told reporters early Monday that “the patient is alive,” triggering applause, but added that the mayor remained “in a very serious condition.”

“The next hours will decide everything,” Stefaniak said, appealing for thoughts and prayers for the popular mayor.

Polish media reported that a number of political officials and Gdansk Archbishop Slawoj Leszek Glod went to the hospital during the operation.

After the knife attack, the assailant shouted from the stage that he had been wrongly imprisoned under a previous national government led by Civic Platform, a party to which the mayor formerly belonged. He said his name was Stefan and that “I was jailed but innocent. ... Civic Platform tortured me. That’s why Adamowicz just died.”

Police said the suspect was a 27-year-old with a criminal record and had carried out bank robberies. A police spokesman, Mariusz Ciarka, said the attacker appeared to have mental problems and gained access to the area with a media badge.

He was arrested and is under investigation.

TVN footage showed Adamowicz on stage with a sparkler in hand telling the audience that it had been a “wonderful day” and then the attacker came toward him. The mayor had been on the streets of his Baltic port city earlier in the day collecting money for the charity, along with volunteers around the country.

European Council President Donald Tusk, a former Polish prime minister who co-founded Civil Platform and is from Gdansk, wrote on Twitter: “Let’s all pray for Mayor Adamowicz. Pawel, we are with you.”

The head of the charity, Jerzy Owsiak, is a liberal critic of Poland’s current right-wing government. He blamed what he described as an atmosphere of hate under the ruling Law and Justice party for the attack on the mayor.

Adamowicz, 53, has been mayor of Gdansk since 1998. He was part of the democratic opposition born in that city under the leadership of Lech Walesa during the 1980s. After leaving Civic Platform, he was re-elected to a sixth term as an independent candidate in the fall.

As mayor, he has been a progressive voice, supporting LGBT rights and tolerance for minorities. He marched in last year’s gay pride parade, a rare action for a mayor in Poland.

He also showed solidarity with the Jewish community when the city’s synagogue had its windows broken last year, strongly denouncing the vandalism.

“Horrified by the brutal attack on Gdansk mayor Pawel Adamowicz,” said Frans Timmermans, a Dutch politician and leading European Union official. “Hope and pray he will recover. A great leader of his city and a true humanitarian.”

The Great Orchestra of Christmas Charity raises money to buy state-of-the-art medical equipment for Poland’s cash-strapped state hospitals, mostly for children.

Loading... Loading... Loading... Loading... Loading... Loading...

The last attack on a politician in Poland was in 2010 in Lodz. A man shouting that he wanted to kill Law and Justice party leader Jaroslaw Kaczynski fatally shot an aide to one of the party’s lawmakers to the European Parliament. A second man was stabbed and injured.

At the time Law and Justice was in the opposition and Kaczynski blamed the attack at an “atmosphere of hate” under the rival party, Civic Platform.