Officials say an hours-long standoff in Philadelphia ended with a suspect in custody. Six officers were shot and all have been released from the hospital.

The man who police say shot six officers during the lengthy standoff surrendered shortly after midnight Thursday.

Police say, for more than seven hours, the suspect was holed up in a north Philadelphia building.

It all happened after police say they went to the home around 4:30 Wednesday afternoon to serve a drug warrant.

Officials say the operation "went awry almost immediately" when the shooter began firing multiple rounds.

Officials say officers escaped through windows and doors, but two officers and three other people were trapped inside until a SWAT team could free them.

Police say the shooter barricaded himself inside the building and was firing multiple rounds out his window.

An attorney says his former client, 36-year-old Maurice Hill, is the suspect and called for help.

Hill was not injured during the standoff. All six officers who were shot were released from the hospital.