RIO DE JANEIRO — A fire ignited by a flare from a band’s pyrotechnics spectacle swept through a nightclub filled with hundreds of university students early on Sunday morning in Santa Maria, a city in southern Brazil, killing at least 233 people, officials said.

Health workers hauled bodies from the club, called Kiss, to hospitals in Santa Maria all through Sunday morning. Some of the survivors were taken to the nearby city of Porto Alegre to be treated for burns. Valdeci Oliveira, a local legislator, told reporters that he saw piles of bodies in the nightclub’s bathrooms.

Col. Guido Pedroso de Melo, the commander of the city’s Fire Department, said in televised remarks that security guards had blocked the exit, which intensified the panic as people in the club stampeded to the doors.

Survivors described a frenzied and violent rush for the main exit. Murilo de Toledo Tiecher, 26, a medical student at the University of Caxias do Sul who was at the club, said he and his friends had to push through a crush of people to get around a metal barrier that was preventing the crowd from spilling out into the street. He said some people became trapped after they rushed into the bathroom near the exit, thinking it was a way out. Once he was outside, he said, he tried to pull others to safety.

“If we saw a hand or a head, we’d start pulling the person out by the hair,” he said in a telephone interview. “People were burned; some didn’t even have clothes.”

The disaster ranks among the deadliest of nightclub fires, comparable to the 2003 blaze in Rhode Island that killed 100 people, one in 2004 in Buenos Aires in which 194 were killed, and a fire at a club in China in 2000 in which 309 people died.

The disaster in Santa Maria, which is in the relatively prosperous state of Rio Grande do Sul, shocked the country. President Dilma Rousseff canceled appointments at a summit meeting in Chile to travel to Santa Maria, a city of about 260,000 residents that is known for its cluster of universities.

The circumstances surrounding the blaze, including the use of pyrotechnics and the reports of the blocked exit, are expected to raise questions about whether the club’s owners had been negligent. While it was not clear why patrons were initially not allowed to escape, it is common across Brazil for nightclubs and bars to have customers pay their entire tab upon leaving, instead of on a per-drink basis.

More broadly, the blaze may focus attention on issues of accountability in Brazil and point to the relaxed enforcement of measures aimed at protecting citizens, even with the economy on solid footing.

The nation’s civil service has grown significantly over the past decade, tax revenues are soaring and there is no shortage of laws and regulations governing the minutiae of companies large and small. Yet preventable disasters still commonly claim lives in Brazil, as illustrated by Rio de Janeiro’s building collapses, manhole explosions and trolley mishaps.

“Bureaucracy and corruption also cause tragedies,” said André Barcinski, a columnist for Folha de São Paulo, one of Brazil’s largest newspapers.

Some of the survivors’ criticisms pointed to a heated argument over who was responsible. “Only after a multitude pushed down the security guards did they see” what they had done, Mr. Tiecher, the medical student, said in comments posted on Facebook.

In an interview, he said that security guards had blocked the club door and initially prevented people from escaping because they thought a fight had broken out inside, and that customers would use the opportunity to leave without paying their bar tabs. Only after they realized that a fire was raging inside did the security guards let the crowd go, Mr. Tiecher said.

Witnesses said the fire started about 2 a.m. after a rock band, Gurizada Fandangueira, began performing for an audience made up mostly of students in the agronomy and veterinary medicine programs at a local university. Mr. Tiecher said the band’s singer lighted a kind of flare and held it over his ahead, accidentally setting the ceiling on fire. Members of the band were seen trying to douse the flames.

At least one member of the five-person band, which is based in Santa Maria and had advertised its use of pyrotechnics, was said to have been killed. Many of the victims died of smoke inhalation, officials said.

“The smoke spread very quickly,” Aline Santos Silva, 29, one of the survivors, said in comments to the Globo News television network. “Those who were closest to the stage where the band was playing had the most difficulty getting out.”

Human rights officials focused Sunday on the grief in Santa Maria. “How many families are now searching for their young one?” asked Maria do Rosário Nunes, a cabinet minister who is Ms. Rousseff’s top human rights official.

Brazilian television stations broadcast images of trucks carrying corpses to hospitals where family members were gathering. Photographs taken shortly after the blaze and posted on the Web sites of local news organizations showed frantic scenes in which people on the street outside the nightclub pulled bodies from the charred debris.

Parents and other family members wandered through Santa Maria on Sunday searching for their loved ones. “I still think she hasn’t died,” Cibela Focco, 35, whose daughter was in the nightclub and still had not been heard from, told reporters Sunday evening.

The tragedy took place in a region of Brazil where Ms. Rousseff spent much of her early political career before rising to national prominence as a top aide to the former president, Luiz Inácio Lula da Silva, and running for president herself. Before leaving the meeting in Chile, she appeared distraught, crying in front of reporters as she absorbed details of the blaze.

“This is a tragedy,” she said, “for all of us.”