Security guards tried to block people from leaving a nightclub in Brazil where more than 230 people were killed in a fire, survivors and rescuers have said.
A preliminary investigation also found that the club's single exit was blocked by the bodies of those already dead.
The fast-spreading blaze raged through the crowded Kiss nightclub in Santa Maria, with a cloud of toxic smoke setting off panic as party-goers gasping for air rushed to the exit.
Witnesses said a flare or firework lit by members of a band onstage started the fire.
Police inspector Marcelo Arigony confirmed survivors’ accounts that security guards initially tried to block people from exiting the club.
Brazilian bars routinely make patrons pay their entire tab at the end of the night before they are allowed to leave.
But Mr Arigony said the guards did not appear to block fleeing patrons for long.
"It was chaotic and it doesn't seem to have been done in bad faith because several security guards also died," he said.
Officials say 233 people died, and around 117 others were injured.
The blaze broke out while the band, called Gurizada Fandangueira, was performing in the club, which was overcrowded with some 1,500 people.
Some of those who escaped the building tried to smash a hole in the wall to allow other trapped people out.
Fire chief Guido de Melo said there was panic after the fire started and many revellers were trampled. He said the main cause of death was asphyxiation.
Mr Melo said firefighters had a hard time getting inside the club because "there was a barrier of bodies blocking the entrance".
"Security guards blocked their exit and did not allow them to leave quickly. That caused panic," he said.
Within hours, the bodies of the victims were lined up in a community gym, partially covered with black plastic as desperate family members identified their relatives.
Many of those who died were under 20 years old, including some children.
The cause of the blaze was under investigation.
Mr Melo said the club was authorised to be open, though its permit was in the process of being renewed.
But he pointed to possible safety violations - from the flare that went off during the show to the locked door that kept people from getting out.
"The problem was the use of pyrotechnics, which is not permitted," Mr Melo said.
Police inspector Sandro Meinerz told the Agencia Estado news agency the band was to blame for a pyrotechnics show and that manslaughter charges could be filed.
The club's management said in a statement that its staff were trained and prepared to deal with any emergency. It said it would help authorities with their investigation.
Television images showed black smoke billowing out of the nightclub as shirtless young men who had attended a university party joined firefighters using axes and sledgehammers to pound at windows and pink exterior walls to free those trapped inside.
Bodies of the dead and injured were strewn in the street and panicked screams filled the air as medics tried to help.
"There was so much smoke and fire, it was complete panic, and it took a long time for people to get out, there were so many dead," survivor Luana Santos Silva told the Globo TV network.
Another survivor, Michele Pereira, told the Folha de S Paulo newspaper she was near the stage when members of the band lit flares that started the fire.
"The band that was onstage began to use flares and, suddenly, they stopped the show and pointed them upward," she said.
"At that point, the ceiling caught fire. It was really weak, but in a matter of seconds it spread."
Guitarist Rodrigo Martins told Radio Gaucha that the band had started playing at 2.15am.
"We had played around five songs when I looked up and noticed the roof was burning," he said.
"It might have happened because of the Sputnik, the machine we use to create a luminous effect with sparks. It's harmless, we never had any trouble with it.
"When the fire started, a guard passed us a fire extinguisher, the singer tried to use it but it wasn't working."
He confirmed that accordion player Danilo Jacques, 28, had died, while the five other members made it out safely.
Mr Martin told Radio Gaucha that the band was already seeing hostile messages.
"People on the social networks are saying we have to pay for what happened," he said. "I'm afraid there could be retaliation."
Brazil President Dilma Rousseff arrived to visit the injured after cutting short her trip to a Latin American-European summit in Chile.
"It is a tragedy for all of us," Ms Rousseff said.
Britain's Foreign Office Minister Hugo Swire said he was "deeply saddened" by "tragic accident" and sent his condolences.
The blaze was the deadliest in Brazil since at least 1961, when a fire that swept through a circus killed 503 people in Niteroi, Rio de Janeiro.