Updated

The suspect linked to Wednesday's hours-long standoff in Philadelphia surrendered to authorities just after midnight Thursday, exiting the residence with his hands in the air and with a police light shining on him, surrounded by a cloud of tear gas.

The dramatic shootout in Philadelphia stretched on for hours as six officers were shot -- and two officers and three hostages were later freed, apparently unhurt.

The suspect was identified by unnamed police sources as Maurice Hill, 36, of Philadelphia.

VIOLENT FELON WHO KILLED CALIFORNIA HIGHWAY PATROL OFFICER 'WASN'T A MONSTER,' HIS WIDOW INSISTS

Hill has a long record of gun-related convictions and of attempting to evade arrest, the Philadelphia Inquirer reported.

Shaka Mzee Johnson, the attorney who most recently represented Hill, also confirmed to the Inquirer that Hill was linked to the standoff.

One of the wounded officers reportedly was grazed in the head in the ongoing shootout in the city's Nicetown neighborhood that began on Wednesday afternoon.

Three officers were rushed to Temple University Hospital, officials told Philadelphia's FOX 29.

Three other officers were taken to Einstein Hospital, at least one of them was shot in an arm. All six officers were in stable condition and treated for non-life-threatening injuries before doctors released them, Philadelphia police Sgt. Eric Gripp said.

"Fortunately, everybody is going to be OK," Ross said, even as the shooter refused to surrender to officers during ongoing negotiations.

He called the outcome "nothing short of a miracle that we don't have multiple officers killed today. We are so thankful for that."

Officers gather for crowd control near a massive police presence set up outside a house as they investigate a shooting in Philadelphia, Wednesday, Aug. 14, 2019. (Associated Press)

Officers gather for crowd control near a massive police presence set up outside a house as they investigate a shooting in Philadelphia, Wednesday, Aug. 14, 2019. (Associated Press)

Two other officers, including a police sergeant, were injured in an accident related to the emergency response and were being treated for non-life-threatening injuries.

Ross said two officers with the Narcotics Strike Force were serving a warrant at the multifamily home -- in what may have been a drug-related offense -- when things "went awry almost immediately," and the shooter opened fire at the home. The two officers were barricaded in separate rooms with several hostages.

After five hours of enduring consistent gunfire, the two officers were safely evacuated, according to Gripp.

Hostage negotiators and a SWAT team were on the scene.

"Officers are attempting to communicate with the shooter; imploring him to surrender and avoid further injuries," Gripp tweeted.

Ross said at the time that some suspects "were taken into custody initially and there may be someone in custody inside [the building] but there's no indication that the shooter is trying to surrender." He added that police were confident the shooter was still alive given the frequency of shots still being fired, but police have not been able to speak to the shooter after nearly four hours of negotiations.

Law enforcement officials continued to make repeated attempts to talk to the shooter, communicating over a loudspeaker as well as trying to reach him by phone, Ross said. Police also were trying to work with a person close to the shooter to make contact with him, but the suspect answered the phone but didn't speak. Fox News has learned that that liaison was the shooter's girlfriend.

Officers gather for crowd control near a massive police presence set up outside a house as they investigate an active shooting situation, in Philadelphia, Wednesday, Aug. 14, 2019. (Associated Press)

Officers gather for crowd control near a massive police presence set up outside a house as they investigate an active shooting situation, in Philadelphia, Wednesday, Aug. 14, 2019. (Associated Press)

"He continues to fire rounds out of a window," Ross said.

The SWAT team initially attempted to enter the building but were forced to retreat because of heavy gunfire through the first-floor ceiling up towards a higher floor of the building, as well as out the window, a law enforcement official told Fox News.

Hundreds of rounds of gunfire could be heard throughout the afternoon. The gunman was armed with an AR-15 and several handguns, officials told Fox News.

Philadelphia police staging as they respond to the active shooting situation.

Philadelphia police staging as they respond to the active shooting situation. (Associated Press)

Ross said many rounds of ammunition struck the SWAT truck and buildings across the street and "right now we're not sure" if it's just one shooter.

Philadelphia Mayor Jim Kenney said he's "angry about someone having all that weaponry and all that firepower."

Officials negotiating with the suspect tried to assure him that he would not be harmed if he surrendered, to no avail.

"We're just trying to do as much as we can to resolve this peacefully," Ross said, adding that it's a "very volatile situation that is still unfolding."

Ross later said that the shooter's attorney was on a three-way call along with law enforcement, trying to persuade the suspect that he would not be harmed if he surrendered.

Four women who were on the second floor of the building as the shootout continued were rescued by police officers and led to safety.

“I thank God for these cops. They’re good people. Don’t say nothing bad about them, they kept us safe the whole time,” one of the women told KYW-TV.

President Trump was made aware of the unfolding scene in Philadelphia, according to White House deputy press secretary Hogan Gidley.

Law enforcement with a gun drawn in the Nicetown neighborhood of Philadelphia.

Law enforcement with a gun drawn in the Nicetown neighborhood of Philadelphia.

“The President has been briefed on the shooting in Philadelphia and continues to monitor the situation,” Gidley said.

The situation is being described as an active shooting scene that began around 4:30 p.m.

Officers called for backup frantically saying "shots fired, shots fired at North 15th street."

Police standing outside a house as they investigated the active shooting situation.

Police standing outside a house as they investigated the active shooting situation.

Video footage of the scene showed a massive police presence in the neighborhood as hundreds of responding police officers and police cars from the Philadelphia Police Department as well as special agents from the Philadelphia Field Division and the FBI blocked off the streets, crouching behind cars, many with their guns drawn, in search of a possible gunman, according to reports by WCAU.

Pennsylvania Attorney General Josh Shapiro issued a statement as the standoff continued late Wednesday:

“Tonight’s events are what tear at the fabric of our Commonwealth. We are indebted to the men and women who stand on the front lines protecting our cities, towns and neighborhoods- those who run towards danger when instinct tells you to run away.  That is the kind of bravery I see from law enforcement across our Commonwealth every day.”

“My thoughts are with the officers wounded in tonight’s horrific incident, their families who share the burden of service, and the medical professionals who worked to treat them,” the statement continued.

“I’ve communicated with Police Commissioner Ross and offered our office’s resources for any needs his department has during this time.  Our communities cannot sustain this type of violence.  This cannot continue,” he said.

One officer appeared injured and was taken away in a police car. Video also showed two other officers carrying a man and putting them in the back of a police car, according to reports by The Associated Press. Police are cautioning the community to stay indoors as gunshots continue to ring out in the neighborhood.

Gripp tweeted, "Suspect is still firing. STAY OUT OF THE AREA."

Philadelphia has been riddled with drug-related crime with several major busts occurring since the beginning of 2019.

U.S. officials seized over $1 billion worth of cocaine in June from a ship at a Philadelphia port, in a bust that the U.S. attorney’s office called one of the largest in American history.

CLICK HERE TO GET THE FOX NEWS APP

One month later, law enforcement officials seized six kilos of heroin and fentanyl, two kilos of cocaine, five handguns, one rifle, $200,000 cash, as well as other drug paraphernalia after a 3-month long wiretap investigation on the Kensignton neighborhood in Philadelphia.

In March, drug dogs sniffed out 1,185 pounds of cocaine worth about $38 million, a bust that was recognized at the time as the city’s largest seizure of the drug in more than two decades.

This is a developing story. Check back for updates. Fox News' Rick Leventhal in Philadelphia and The Associated Press contributed to this report.