FAIRFIELD — Five dogs and a family are safe after a fire damaged a home on Stratfield Road on Saturday afternoon.

Three of the dogs were rescued from the basement, while the other two were found elsewhere in the house, Fire Lt. Robert Smith said.

A photo from the scene that the fire department shared on social media shows a firefighter walking with a black dog, while another firefighter carries a pup out of a smoldering building.

The family escaped before crews arrived, Smith said.

“But they couldn’t get to the dogs because of the heavy smoke and fire,” he said.

American Medical Response treated the animals, Smith said.

“All the dogs are well,” he said.

When firefighters arrived around 4:30 p.m., the flames looked like they could spread to the house next door, Smith said. He said crews attacked the flames on that side of the home before rescuing the dogs.

It took about 20 minutes to get the fire under control, but crews remained at the home until after 9 p.m. as the fire marshal investigated, Smith said. The cause and origin of the fire is still being determined, he said.

The flames left extensive damage to the 2 1/2 story wood-frame home, forcing the residents to move in with friends and family, Smith said.

This story has been updated with additional information.