A gunman suspected of killing six people, including a British man, and injuring 16 in a rare mass shooting in a busy market square in Kraków has died in hospital, Polish police said.

The 24-year-old Polish national, who has not yet been officially named, opened fire in the city’s main square on Saturday afternoon in an attack that a government minister said was probably influenced by far-right ideologies. He was wounded during a shootout with police and taken to hospital in a critical condition.

“We would like to inform you that the perpetrator of the tragic events died in hospital early this morning,” Małopolska police wrote on X on Monday.

Soon after the attack, the bodies of the gunman’s parents and sister were found at the family home in Ostrowiec Świętokrzyski, a town about 100 miles north-east of Kraków. Police said they had probably died of gunshot wounds.

Polish prosecutors opened a terrorism investigation, which the justice minister, Waldemar Żurek, said would continue despite the gunman’s death and would aim to establish if he acted alone or was inspired by any group. However, he called for “restraint” after the interior minister, Marcin Kierwiński, said on Saturday that the gunman was fascinated with far-right ideologies and held “very radical” and “ultra-nationalistic” views.

“Evidence is ​being collected, ​but I will not ​show or disclose it. I ask for restraint,” ​Żurek told Radio ‌Zet.

Wearing military-style clothing and a bulletproof vest, the gunman drove at high speed into the square in the heart of the old town, which is usually packed with tourists, and started shooting at random in a “wild ride” around the square, the Kraków police spokesperson Katarzyna Cisło said.

Karolina Gałecka, an ⁠interior ministry spokesperson, told radio TOK FM ​on ​Monday: “There ​were many different emblems on the perpetrator’s clothing that have been partially examined and interpreted.

“These patches were ​associated with various motifs that ​are currently ‌being analysed ​by ​specialists,” she added, declining to comment further as the investigation was ongoing.

The shooting has shocked a country that was considered safer than many of its European neighbours, and has deepened concern after several school stabbings in October that left one woman dead and which officials said were linked to extremist content online.

Among the six victims were a 32-year-old British man and an Austrian woman aged 51. The other four victims were Polish nationals.

Of the 16 injured, 15 were in a stable condition as of late Sunday, including two police officers who were brought out of medically induced comas earlier in the day. Five of the injured were from Britain, Austria, Germany, Portugal and Russia.

Police said the suspect, who had no criminal record and held a firearms licence, initially continued shooting even after he was wounded by police during the exchange of fire. The two injured police officers – Jakub Kulik, a former paratrooper and volunteer firefighter, and Artur Morański– were hailed as heroes for their rapid response and for preventing further casualties.

Police confirmed on Sunday that three people found dead at the gunman’s home were his father, 53, mother, 52, and sister, 21.

Mourners have left candles in tribute to the victims in the square, which reopened late on Sunday. Flags across the country were lowered to half mast during two days of national mourning, as were European flags outside the European Commission in Brussels “in solidarity with the Polish people”, the commission said.