The fire was reported just before 2 a.m. on the 400 block of 23rd Avenue, fire officials said.

Two men, ages 62 and 75, were transported to a hospital and treated for smoke inhalation, according to the San Francisco Police Department. Another man had burns on his hand but was treated on the scene, fire officials said.

One child was also hospitalized with minor injuries, and a firefighter was hospitalized with lacerations to his hands but has since been released, officials said.

Firefighters also rescued a cat from the burning building.

The fire, which police said was ignited by a lit candle that caught a blanket on fire, was under control by 3:15 a.m.