Three bodies were pulled from the rubble of three collapsed buildings on Thursday, an official with the Rio de Janeiro Fire Department said. Another 21 people were still missing after the buildings went down in the city's historic center.

Mayor Eduardo Paes said a structural problem may have caused a building of about 20 stories to collapse at about 8:30 p.m., and that apparently caused the collapse of two smaller buildings nearby. Officials were still investigating the causes, however.

In addition to the dead and missing, at least six other people were treated for injuries caused by the accident, which left rubble and thick dust strewn over a wide area near Rio's famed Teatro Municipal and the Fine Arts Museum.

One of those pulled out alive was Marcelo Moreira, a janitor in an eight-story building that fell.

"He stayed behind to finish a little bit of work," said Rosalvo Alves, the building's main doorman, who had spent the night in a local hospital with his friend. "We shut down at 8. I left, and he was supposed to come too. Now this; he's hurt, our jobs are gone, everything is gone."

More On This... Building Collapses in Brazil

Alves worked in the building for 38 years, and said he had never noticed any problems.

A cloud of dust was still drifting from the building the next as rescue crews dug through tons of brick and twisted metal, hoping to find survivors.

"Firefighters and others are working to find the missing," said Moises Torres, a spokesman with the Fire Department who confirmed the numbers of dead and missing. "We have hopes of finding people alive."

Relatives and friends of the missing gathered inside a nearby government building, taking shelter from from the scorching sun as they waited for news.

Francisco Adir was trying to get information about a friend who had been attending a computer course in the in the largest of the three buildings.

"We think he's alive. At 3 a.m. he managed to call his girlfriend and say, 'Hello, love," before his phone went dead," Adir said. "The rescuers haven't given us any information, but the family is hanging all their hopes on that phone call."

A building inspector told the Globo television network that a survivor from the collapse was a worker on a construction project being performed in the first building that went down, and that illegal projects could have led to the collapse.

"Two projects were happening in the building, on the 16th floor," said Luiz Cosenza, head of the accident prevention unit of Rio's Regional Council of Engineering, in charge of building inspections. "They were illegal works; they were not registered with the council."

He didn't provide details on what sort of construction work was being carried out, but said that it was not being supervised by any registered professional.

Shortly after the collapse, there was a strong smell of natural gas in the area, but Mayor Paes said that probably did not cause the problem.

"There apparently was not an explosion. The collapse occurred because of structural damages," he said. "I don't think there was a gas leak."