A fire that broke out at an “escape room” game in northern Poland, killed five teenage girls and injured a man, the authorities said on Saturday.

The blaze began around 5 p.m. Friday in Koszalin, about 240 miles northwest of Warsaw. The cause of the fire was being investigated. At first, firefighters on Saturday blamed substandard electrical wiring and lax security procedures at the escape room for the fire.

Poland’s firefighting chief, Leszek Suski, said that the electrical wiring at the venue was too close to flammable materials.

“Security was not ensured and that led to the tragedy,” Chief Suski said, adding that there had been no proper evacuation route and a “lot of negligence” at the location.

But later, the Koszalin prosecutor, Ryszard Gasiorowski, said a leak in the bottled gas heating system at the venue might be to blame.

Mr. Gasiorowski said the fire probably broke out in the reception room and blocked a pathway to evacuate the girls. Officials said the victims probably died of asphyxiation. Autopsies will be carried out to confirm the cause of the deaths.

None of them were immediately identified.

Interior Minister Joachim Brudzinski said the girls were all 15 years old. He said he had ordered fire safety checks at all 1,000 such sites in Poland.

In the game, which is popular with teenagers worldwide, players are locked inside a room or building and they must work together to find clues and solve puzzles to escape simulated danger before time runs out.

Monika Kosiec, a spokeswoman for the Koszalin police, said the victims were thought to have been celebrating a birthday. She said a man, 26, had been hospitalized with burns and could not be immediately questioned by investigators.

A spokesman for regional firefighters, Tomasz Kubiak, said the bodies had been found in a room that was near the blaze but was not hit directly by it. He said the units responding to the blaze had to use specialized equipment and force their way into the venue.

Footage on the private TVN24 channel showed ambulances and fire engines in front of a detached two-story house with a large Escape Room sign in front.

President Andrzej Duda said on Twitter it was a “crushing tragedy” that five young girls had died so early in their lives.

The girls, friends from one school class, were celebrating one of their birthdays, officials said.

Koszalin’s mayor, Piotr Jedlinski, announced that Sunday would be a day of mourning in the city.

Officials have extended psychological, psychiatric and other support to the families of the victims. The school that the teenagers had attended was extending counseling and support to their friends and colleagues.

Local residents placed flowers and lights in front of the game venue.

The industry behind escape rooms, which originated in Japan and evolved from video games, has grown rapidly around the world in recent years. Most of the sites in the United States are mom-and-pop operations with one or two sites. In 2014, there were 22 escape room companies in the United States; that number has grown to 2,000, according to enthusiasts.

Mission Escape Games, which opened in 2014 in New York and now has four other locations, says it attracted 140,000 visitors in 2017.

In Britain, the number of escape rooms has soared to more than 1,000 as of last year from seven in 2013, according to the BBC.