Graham said it appeared that more than 100 people would be displaced as a result of the fire, which caused about $1.5 million in damage.
He said an electrical socket near a bed in a lower-floor apartment apparently ignited a mattress and the blaze spread upward.
One firefighter was gasping for breath as he emerged from the building in the 9300 block of Piney Branch Road, said Timothy Smith, who lives in a nearby building.
Smith said he arrived at the scene in time to see people still in the building, on their balconies. “I was telling people to run out,” he said.
Another man, who also lives in a neighboring building, said he saw an acquaintance on a balcony and shouted for him to get out. He said the man and his girlfriend ran down the stairs “holding their breath.”
Nevertheless, he said, the girlfriend “inhaled a lot of smoke” and was apparently one of those taken to hospitals.
The man said he shouted to others on balconies, but they said they could not leave because the hallways were filled with smoke. They were apparently rescued by ladder, he said.
The fire was reported about 4 p.m., officials said. By about 6 p.m., it appeared to be under control.
As firefighters arrived, intense flames were coming from a second-floor apartment balcony. One man was helped down a ladder by firefighters and others were aided in escaping down the stairs, Graham said.
Smoke billowed from the flat roof of the building, and flames could be seen on the roof.
The site of the fire is just west of New Hampshire Avenue, in a building that was part of a complex of buildings of five or six stories in height.
About 6:30 p.m., neighbors stood around in knots as firefighters continued to train hoses on the building, Smith said. “They’re still shooting water,” he said.
Firefighters from Prince George’s County were also sent to the blaze, and two were taken to hospitals, said fire department spokesman Mark Brady.
Traffic was shut down on a segment of Piney Branch Road.