Thousands of people attended the shock Sunday when a man rushed to the scene and stabbed Pawel Adamowicz, 53, to heart and stomach. He died a day later despite emergency surgery.
A mob followed his coffin in a funeral procession Friday in the cold streets of the city he had served for more than two decades to the main church, St. Mary's Basilica.
The President of the European Council, Donald Tusk, a native of Gdansk and friend of Adamowicz, was among those who attended Mass on the eve of the funeral.
Polish President Andrzej Duda declared a day of national mourning from Friday to Saturday.
Walks and vigils took place this week in Gdansk and other Polish cities, in solidarity with the mayor and against the increasingly toxic nature of rhetoric in Polish politics.
The funeral procession started at the European Solidarity Center, a museum dedicated to the pro-democracy solidarity movement in Poland. Long lines of people waited earlier in front of the museum, in the cold, to pass and pay their last respects before his flower coffin.
The frantic attack took place during the final of a charity event at the Children's Hospital, known as the Grand Christmas Orchestra, while Adamowicz thanked all those who had helped raise funds to buy medical equipment.
The suspect, 27, who was arrested, is a resident of Gdansk who was found guilty of bank robbery and spent many years in prison. Gdansk City press officer Dariusz Wołodźko said the suspect had come on the scene shouting and accused the mayor and his party of his conviction and imprisonment.
Born in Gdańsk and raised in Gdansk, Adamowicz has long been an integral part of the public life of the Baltic port city. He entered local political life in 1990 as a city councilor before becoming mayor of Gdansk, a position he held for more than 20 years.
He was known as a progressive voice in a country ruled by a populist and resolutely right-wing government. He was a strong supporter of LGBT rights, immigrants and minority groups.