A father and his 4-year-old daughter were rescued from the roof of their burning York City home in the predawn hours Saturday morning.

Shortly after midnight, a smoke detector alerted the father, who was sleeping on the second floor, to a fire on the first floor of the home at 439 Walnut Street, said York City Fire Chief David Michaels.

The father woke the daughter, who was also sleeping on the second floor, and tried to escape with her down the stairs through a first-floor exit, the chief said. But smoke was too thick, so the father and daughter retreated to the roof after crawling through a third-floor window, Michaels said.

The father's rooftop shouts drew the attention of a neighbor who used a long ladder to assist the two down from the roof, the chief said.

As fire crews were arriving, they were descending the ladder, he said.

There were no injuries, though the daughter was taken to Hershey Medical Center for observation because of smoke inhalation, Michaels said.

It took crews about 45 minutes to extinguish the blaze, the damage from which spread to adjoining homes at 441 and 437 Walnut Street.

Numerous people were displaced, as all three homes are uninhabitable until they can be repaired.

The adjoining homes were mostly damaged by smoke and water, but the unit at 439 Walnut Street, where the fire started, will need more extensive work, the chief said.

He said the fire was accidental and was caused by an electrical problem in the kitchen area. Total damage to all three units was estimated at $80,000.

The fire chief said the father had done at least two things right, and those decisions could've saved his life and his daughter's.

First, he had a working smoke detector to alert him to the fire. Second, he didn't try to force his way through the overwhelming smoke on the first floor.