A certified nursing assistant shot and killed his coworker at Thomas Jefferson University Hospital on Monday, then started a shootout with police officers four miles away before he was apprehended, authorities said.

Two officers were wounded during the early morning gun battle near Fairmount Park in the city’s Parkside section, said Commissioner Danielle Outlaw. The suspect — who was wearing body armor and carrying several weapons, including a semiautomatic assault rifle, and had fled the Center City hospital in a U-Haul truck — was struck in the neck and upper body when officers shot back at him, she said.

Both officers were expected to survive, as was the suspected shooter, whom law enforcement sources identified as 55-year-old Stacey Hayes.

The crime stunned employees of one of the city’s busiest hospitals, shook officers responding to the violence, and devastated friends and relatives of Anrae James, the 43-year-old Jefferson nursing assistant who was killed.

“When I got that call this morning, I couldn’t believe it,” said his father, William James, who said his son was a mild-mannered father of three from Elkins Park.

» READ MORE: Nursing assistant gunned down by coworker at Jefferson Hospital was the father of three

The killing was the second fatal workplace shooting in less than a week in the city. And even amid unprecedented levels of gun violence in Philadelphia this year, the hospital slaying and the shootout with police that followed were especially harrowing.

“This is something that typically you’d see in a movie or on a TV series,” Outlaw said

Many questions remained unanswered Monday as authorities continued to investigate. It is not known how or why Hayes came to the busy hospital to attack his coworker. Authorities had not specified what charges he might face. And they declined to identify the two wounded officers or the two other officers who fired their guns, except to say all had been assigned to West Philadelphia’s 16th District.

Chesley Lightsey, homicide chief in the District Attorney’s Office, said investigators believe Hayes and James were friends, but that it was too early to be sure of the shooter’s motive.

Outlaw said: “We do believe [James] was targeted. The reasons why, at this point we still don’t know.”

Court records revealed another mystery: In June, Hayes successfully petitioned the courts to return three guns to him, including a handgun, a shotgun, and an AR-15 rifle.

The records do not say why the guns had been seized in the first place, and the Police Department and court system declined to comment on that case. The judge who signed off on the order — identified in court dockets as Common Pleas Court Judge Crystal Bryant-Powell — did not immediately respond to a request for comment. And attempts to reach Hayes’ relatives were unsuccessful Monday.

In his petition, Hayes said he’d purchased the guns legally and hadn’t committed a crime.

“I am not a threat to anyone, I just want to be able to protect myself and my family if needed,” he wrote.

At three addresses connected to Hayes, Inquirer reporters on Monday found no one home and neighbors who said they didn’t know him. At one in Overbrook Park, police were inside a rowhouse and a neighbor said a U-Haul truck had been parked out front on Sunday.

Outlaw said Monday’s episode began shortly after midnight, when police received a call reporting an active shooter on Jefferson’s ninth floor, which houses units for patients recovering from orthopedic surgery or neurosurgery.

Outlaw said that it was not clear if the suspect was working at the time, but that he was wearing scrubs and had been in parts of the hospital that only employees can access. On a floor for surgery patients, the responsibilities of nursing assistants include helping patients eat and get to the bathroom, bathing them, and taking their vital signs, as well as stocking patient rooms for supplies used by nurses.

Homicide Capt. Jason Smith said the shooting was captured on surveillance video that showed Hayes walking up behind James — who was seated at a workstation — and firing. James got up and tried to run away, Smith said, but Hayes followed him and kept shooting his handgun. At least two bystanders could be seen nearby as bullets flew, Smith said.

Hayes did not appear to have a rifle at the time, Smith said, nor did he seem to be wearing body armor.

Outlaw said he then left the hospital.

Around 1:25 a.m., Outlaw said, a passerby flagged down officers in Parkside, near the School of the Future, saying a man in scrubs nearby had a gun and was possibly firing shots in the air.

When officers approached him, Outlaw said, the suspect fired at them. Two of the four officers were struck, she said, and police returned fire that struck the man in the upper body and neck.

Outlaw said the wounded officers have been on the force for six years. One officer, wounded in the elbow, was in critical but stable condition at Penn Presbyterian Hospital awaiting surgery, she said. The other was shot in the nose and was in stable condition at the same hospital.

Hayes was also taken there in critical condition, police said.

Employees were notified via text just before 1 a.m. that there was an active shooter in the Gibbon Building near 11th and Sansom streets.

“Enact emergency procedures,” it read. “Run, Hide, Fight.”

Employees in a nearby building said an official spoke over a loudspeaker and told them to shelter in place. Some barricaded themselves in a break room for nearly an hour.

Later Monday morning, health-care workers in scrubs flowed out of Jefferson onto 11th Street during a drizzly shift change around 7 a.m. One employee, who did not want to be identified because he was not authorized to publicly discuss the matter, said he was on the floor where the shooting occurred and that his coworkers were “terrified.”

He said he didn’t know the victim but had seen him before.

“We tried our best,” he said, “but we couldn’t save him.”

Alexander Vaccaro, president of Rothman Orthopedic Institute and chair of orthopedic surgery at Jefferson, said: “The nurses were like heroes in how they responded. They risked their lives.”

Jefferson spokesperson John Brand said there was “a flood of sadness for all of us” following James’ death.

“Our hearts are broken as we stand together to remember our colleague and recognize his teammates who tried to save him and protect other patients in the area,” he said.

He added that the hospital would conduct a review of the incident “to ensure best practices in our safety protocols,” though he declined to provide specifics about how Hayes may have been able to access a hospital floor, fire a weapon, and then walk out.

The School of the Future, meanwhile, was closed Monday as investigators placed dozens of evidence markers over shell casings behind the building. Hayes’ Kevlar vest and weapons were visible on the ground until they were retrieved by crime scene officers.

James’ friends and relatives were left to remember a man who worked two jobs — at Jefferson and at a barbershop — to support his three children, ages 2, 11, and 17.

“My son’s legacy is his kids,” said James’ father.

The gunfire at Jefferson followed another workplace shooting on Friday in which Nassir Day, 25, a security guard for Pathways to Housing PA in Logan, was shot and killed.

Outlaw said such situations “are typically incidents that happen far and few in between … it’s not supposed to happen this close together, but we are all prepared to respond quickly and deal with it, and that’s what we will continue to do.”

The shootings come amid the city’s most violent year in decades. There have been at least 418 homicides in Philadelphia this year, according to police statistics, the highest number by early October in at least 35 years. Last year, the city recorded 499 homicides, and Philadelphia has not had back-to-back years exceeding 400 homicides since 1996.

“Obviously the numbers are staggering, it’s heartbreaking in a lot of cases,” the police commissioner said. “There are a lot of juveniles involved, but it’s not going to stop us from doing what we all signed up to do.”

Staff writers Marina Affo, Juliana Reyes, William Bender, Mensah M. Dean, Jason Laughlin, Barbara Laker, Rob Tornoe, Aubrey Whelan, Harold Brubaker, and Diane Mastrull contributed to this article.