Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

WARSAW, Poland — Polish prosecutors charged a man on Sunday who designed an escape room entertainment site where five teenage girls were killed in a fire last week.

Prosecutor Ryszard Gasiorowski said the man, identified only as Milosz S., had been charged with intentionally creating a fire danger and with unintentionally causing the deaths of the girls. The location's heating system was faulty and there was no emergency evacuation route, Gasiorowski said.

The man denied the charges. If convicted, he could face up to eight years in prison.

The arrest came after Polish officials shut down 13 escape rooms, a form of entertainment where players are locked inside a room or building and must solve puzzles and find clues to escape. Officials shuttered the sites over what they described as safety flaws.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Police secure the scene of a fire in an "escape room" that killed five teenage girls in Koszalin, Poland, on Jan. 4, 2019. Marcin Bielecki / EPA

Fire chief Leszek Suski said the escape room where the five teenagers were killed was in a private house in the city of Koszalin. The 15-year-old girls, who had been celebrating a birthday, died Friday locked inside a room with no emergency evacuation route. They were the first known deaths in an escape room, a form of entertainment that has been growing in Poland over the past five years.

Firefighters found the victims' bodies after they extinguished a fire next to the locked room. Autopsies showed that the girls, who were friends from school, died of carbon monoxide inhalation. A young man employed there was hospitalized with burns.

Prosecutors say a leaky gas container inside a heater is the most likely cause of the blaze.

Police chief Jaroslaw Szymczyk said other people had previously posted critical remarks online about the safety of that escape room site, but local officials weren't notified.

During a memorial Catholic Mass at Koszalin Cathedral, Bishop Edward Dajczak identified the girls by their first names as Julia, Amelia, Gosia, Karolina and Wiktoria.

Public prayers were planned later Sunday in front of the house where they died.

Prime Minister Mateusz Morawiecki, along with Suski and Szymczyk, spoke after holding a meeting in which they discussed with other officials ways of improving safety at entertainment venues. Morawiecki called the girls' deaths an "immense tragedy."

Since Friday, more than 200 of Poland's 1,100 escape rooms have been checked, revealing a number of safety flaws that needed to be immediately fixed.