Four people died and 22 remained missing after the collapse of three buildings in the historic center of Rio de Janeiro, Mayor Eduardo Paes said Thursday, according to CNN affiliate TV Record.

It was not immediately clear what caused the collapse of a 20-story building and adjacent 10- and 4-story buildings on Wednesday night. Officials said they were investigating both the possibility of a gas leak and a structural failure.

Sergio Cabral, the governor of Rio de Janeiro state, declared three days of mourning for the victims, while state-run Agencia Brasil reported Brazilian President Dilma Rousseff expressed her solidarity with the people of Rio de Janeiro, "especially with the families of those who were affected by this catastrophe."

Видео дня

Earlier, civil defense officials in Rio de Janeiro corrected an erroneous earlier report that five bodies had been recovered.

Rescue workers continued to dig through the rubble Thursday afternoon.

The accident came at a delicate time for Rio de Janeiro as the city prepares to host the World Cup in 2014 and the Olympic Games two years later.

The buildings were just steps from the emblematic Municipal Theater, where U.S. President Barack Obama gave a speech last year.

Residents told TV Record that they heard the collapse begin before seeing the buildings come down.

"I started to hear a crackling. I thought they were gunshots. When I looked up, I saw the top floors falling," maintenance worker Julio Cesar de Oliveira Brandao said.

A fire broke out after the buildings fell, Agencia Brasil reported. The entire area -- a bustling commercial center during the day and a popular drinking spot at night -- was closed off Thursday.

Cars parked on the street were covered in dust, and there was a strong smell of gas in the area, fire officials said, according to the news agency. The lobby of one of the buildings contained a bank branch and a bakery, Agencia Brasil reported.

Witnesses told Band TV that neighboring buildings swayed, as if there had been an earthquake. One witness said people were inside one of the buildings when it collapsed.

Electrical engineer Jorge Drauss told TV Record he was drinking juice at a nearby diner when he saw small stones falling from the top of one of the buildings.

"I thought it was someone making a hole for air conditioning," he said. "From one moment to another, the building began to fall."