A toddler climbed out of a second-story window and scampered across the porch rooftops of at least eight row houses before a family dog's barks alerted residents, police and neighbors said.

Neighbors who heard the barking spotted the 23-month-old boy, Phillip Redmond Jr., followed closely by the family's German shepherd, Alfie.

"He was protecting the baby, making sure the baby was all right," neighbor Tina Mitchell told WPVI-TV.

Another neighbor, Shavyonn Robinson, was able to grab the toddler from a porch roof a few doors down Sunday morning, police said.

"First I had my hand sticking out [of the window] trying to grab him," Robinson said. "That's when he tried to run past, because he thought I was playing with him, and he almost fell so I had to go out and get him."

By the time police arrived, the child had been helped down from the roof and officers took him to the hospital, said Sgt. Francis Erickson. The child's footprints and the dog's prints could be seen in the blacktop coating on the porch roofs.

Child welfare officials placed the boy in the care of relatives while the incident is investigated, said the boy's father, Phillip Redmond. He said he was embarrassed but grateful that his son was fine.

"It was my fault," he said. "I didn't think he could get out there."