BIDDEFORD — A three-alarm blaze ripped through a downtown apartment building Sunday night, with flames shooting through the roof at times and firefighters battling to keep the fire from spreading to nearby structures.

Fire Chief Joseph Warren said firefighters were battling a fire in the attic of the building at 25 Green St. late Sunday night and the structure was not yet safe to enter.

“There have been no injuries that I know of, but we have not been able to search the building,” Warren said about 9:30 p.m.

He said investigators from the State Fire Marshal’s Office were at the scene, but had not determined what started the fire.

Residents were evacuated to City Hall a few blocks away, and some said they narrowly escaped the burning structure. Tenants said they believed everyone escaped from inside the building.

The fire at the three-story apartment building, which has about 12 units, was reported at 6:04 p.m., Warren said.

More than 100 firefighters and about 30 firetrucks from Biddeford, Saco, Scarborough and seven other communities responded to the scene, and firefighters directed water on the building from numerous directions.

Residents who escaped the fire described a harrowing scene.

“I looked out the kitchen window and it was full flames,” said Wayne Van Tassel, who lived on the first floor at 25 Green St. “People were yelling, ‘Get out! Get out!’ ”

Van Tassel and his roommate, Theresa Ruzzoli, escaped the apartment with only their jackets.

Jim St. Ours, who lived in a third-floor apartment with his roommate, Nadine Cody, said if he had not smelled smoke when he did, they may not have been able to escape.

“We had to come down the back porch,” St. Ours said in an interview at City Hall. “That went up pretty quickly.”

He said that less than five minutes after they made it outside, the back porch was consumed in flames.

Neighbors of the building scrambled to get away from the blaze.

“I looked out the back window when the firetruck showed up,” said Tim Perkins, who lives next door at 23 Green St. with a roommate, Brenda Salamonski. “The back porch was on fire (at 25 Green St.). I grabbed some stuff and put it in our vehicle and then we left.”

Scott Durepo, the owner of the apartment house 23 Green St., stood across the street with some of his tenants as firefighters sprayed water on the burning building next to his. He said all the tenants of his building had been accounted for, and that he was thankful he had added fire escapes and alarms after buying the building less than 10 months ago.

Lauren Hall, who lives across the street with her grandparents and her 2-year-old daughter, Olivia, said her grandfather, Fern Lamontagne, sprayed the roof of their home with a garden hose to prevent the flames from spreading there.

“My grandfather is freaking out,” she said. “They have been here for 40 years.”

Hall said that “we have everything packed and ready” in case they need to be evacuated.

JoAnne Fisk, deputy chief of the Biddeford Police Department, said that in addition to Biddeford, Saco and Scarbrough, firefighters from Arundel, Goodwins Mills, Alfred, Waterboro, Sanford, Kennebunk and Kennebunkport responded to the blaze.

Warren said the first firefighters to arrive struggled initially to get enough water pressure from hydrants in the immediate area to fight the fire and keep it from spreading. As more firefighters arrived, they ran more hoses to hydrants connected to water mains on Main and Elm streets to beat the flames back.

“There won’t be a search of the building until the fire is completely out because the structure is not safe,” said Warren, the fire chief. “There was so much water that one of the walls of the building is actually bowed out. We had to keep firefighters away from that part of the building in case of a collapse.”

Water flowed downhill from the fire scene through adjacent streets, more than a foot deep in some places. Hundreds of residents watched the firefighters at work from behind police tape.

Warren said he had not heard of anyone still in search of missing relatives.

A Red Cross official at the scene estimated that between 15 and 20 people had been displaced, but officials did not have a final tally Sunday night. The building owner is listed in city records online as Housing Option LLC of Saco.

Sunday night’s fire was about a half-mile from a blaze that occurred Sept. 18 in an apartment building at 35 Main St. That fire, which authorities said was deliberately set, killed two young men and displaced two dozen residents. Dylan Collins, 18, of Biddeford was charged with arson and two counts of murder.

Staff Writer Dennis Hoey contributed to this report.