The mayor of the Polish city of Gdansk has beaten for his life after being stabbed by an armed attacker with a knife in front of hundreds of people at a charity event.

The video shows the assailant getting on the podium and embarking on Pawel Adamowicz, who had wielded sparks on the stage with others during the fundraiser Sunday night.

After repeatedly striking the 53-year-old major, the man turned to the crowd, arms raised triumphant, but was quickly apprehended by security guards and arrested.

Paramedics resuscitated Adamowicz at the scene before taking him to the hospital.

The director of the Gdańsk hospital where the mayor was led, Jakub Kraszewski, told the press shortly before midnight local time (23:00 GMT) that the operation was underway.

"He is in critical condition (…) we are fighting to save him," he said.

"There is hope but its condition remains serious," said Andrzej Duda, president of Poland, wrote on Twitter adding that Adamowicz was alive but "seriously hurt".

A spokesman for the Gdansk police said the attacker was a 27-year-old man living in the port city.

In a video recording of the attack posted on YouTube, the suspect was seen grabbing the microphone and asserting that he had been improperly imprisoned by the previous centrist government's Civic Platform and that he had been tortured.

"That's why Adamowicz is dead," he said before being shot down by security.

A witness told TVN TV that the man seemed "happy with what he had done".

Adamowicz before being attacked during the charity event [File: Agencja Gazeta/Bartosz Banka via Reuters]

Convicted criminal

Adamowicz is the mayor of Gdansk, which has about half a million inhabitants, for two decades and the Civic Platform has supported his re-election in the 2018 municipal elections.

Sunday's Lights to Heaven fundraiser, organized by the Christmas Charity Grand Symphony Orchestra, the country's largest charity, was part of a nationwide fundraising campaign to raise money for the organization. 39 purchase of medical equipment and included a colorful scene including lights, smoke and pyrotechnics.

According to Polish media reports, the suspect was reportedly sentenced to more than five years in prison for four armed robberies on banks in Gdansk.

His mental condition was severely deteriorated during his stay in prison, according to reports.

Police were investigating how the attacker could have breached security to reach the podium, police spokeswoman Joanna Kowalik-Kosinska told Gdansk.

"We know that he used an identifier with the inscription" Press "," she said.

"Now, we must establish how this was obtained, the accreditation was in his name and was he really entitled to be there at that time?"

Polish Prime Minister Mateusz Morawiecki condemned the attack on Twitter and Interior Minister Joachim Brudzinski described it as "an act of incomprehensible barbarity".