PHILADELPHIA (AP) _ An arsonist torched a foster home and the blaze killed four children and injured 12 people, fire officials said.

Neighbors said they woke up shortly before 3 a.m. Thursday smelling smoke and hearing children yelling.

''It was a nightmare,'' said Frank Hart, a neighbor who woke to see the house in flames but managed to help six people to safety.

''People were jumping from the second and third floor,'' he said. ''There was blood and people with broken bones and charred bodies all around.''

The fire, which was started on an enclosed porch, was the work of an arsonist, said fire Lt. Jack Christmas.

Kenneth Postell, 24, who lived on the third floor, said when he awoke he saw a ''big huge smoke ball'' in his room. He said he jumped to a second-floor roof and from there to the ground. Postell and a child were the only ones to escape injury.

When firefighters arrived at the large three-story stone-and-frame house, they found heavy fire in the first floor and people trapped upstairs. The fire was under control by 3:20 a.m., firefighters said.

Seventeen people lived in the house, according to firefighters. The children who died were found on the second floor. Police identified them as Keith Moye, 7, and his brother, Preston Moye, 5; Anwar Hartwell, 9, and Robert Lavenhouse, 15.

The house belonged to Hubert and Rose Artis, a couple who took in foster children and had lived there for about 13 years.

Mrs. Artis, 65, was in critical condition at Albert Einstein Medical Center with multiple fractures and smoke inhalation. Hubert Artis, 65, was in stable condition at Temple University Hospital suffering from smoke inhalation.