They just needed 30 seconds more, a firefighter sergeant said.
He had thrown a rope with an improvised harness to a man hanging from a burning building in Sao Paulo's old downtown, and the man managed to secure his leg and shoulders.
But just as the sergeant's team was ready to tug the man away, the building collapsed like a pile of dominoes, pulling the man into a cloud of red-hot debris.
Brazilian TV broadcast the dramatic rescue attempt and the collapse of an abandoned government building that had been occupied by squatters.
By the end of the day, only the man whose rescue failed was believed dead.
Firefighters and dogs were continuing to search the smoldering rubble — some of which was still too hot to walk over — for his body and any other victims.
No firefighters were hurt.
"Of course, it's impossible to not be emotional," firefighter Sergeant Diego Pereira da Silva Santos later told reporters. "It was a victim, it was a person who needed help, who shouted for help."
The sergeant described how he and his team climbed onto the roof of a neighbouring building — using axes to gain access.
He said he urged the man to be calm, to look only at the firefighters, to try to ignore the blazing heat coming from the fire.
"He was secured, he was ready," Santos said. "The problem was the building collapsed and the amount of rubble and hot embers that fell on him."
The building, a former federal police headquarters, caught fire around 1.30 am local time and firefighters worked to evacuate people. Less than two hours later, the 25-floor building collapsed.
The cause of the fire is under investigation.
The blaze scorched the facade of a neighbouring building and damaged a church. In all, five buildings nearby were evacuated.
Local media said that between 50 and 150 were currently living there, underscoring the sometimes fluid nature of such makeshift dwellings.
- AP