A man who opened fire on police surrendered Wednesday morning after a nearly two-hour standoff in Philadelphia's Feltonville section, authorities said.

A woman who was in the house with the alleged gunman was unharmed.

The man's name has not been released pending charges.

Police Chief Inspector Joe Sullivan said the drama started about 5:50 a.m., when officers responded to a call for someone screaming inside a house on the 500 block of Courtland Street.

On arrival, officers saw the man on the porch and when they approached, he ran inside, where he fired at least two shots at the police, Sullivan said,

The officers retreated, set up a perimeter and called for a SWAT team, Sullivan said, adding the officers "showed incredible restraint and good judgment."

When the SWAT team arrived, Sgt. Joe McDonald, who also is a hostage negotiator, opened contact with the man and convinced him to surrender around 7:45 a.m., Sullivan said.

A firearm was recovered and police were seeking a warrant to make a complete search of the house.

He said it was not yet clear what prompted the screaming that resulted in officers being called to the house in the first place.