A doctor with an assault rifle opened fire Friday in the Bronx hospital where he had been forced to quit, killing a physician and injuring six others as he targeted the staff before ending his own life, New York City officials said.

The gunman tried to set himself on fire at the Bronx-Lebanon Hospital Center and was found on the 17th floor with a self-inflicted gunshot wound after starting his rampage just before 3 p.m. on the 16th floor, NYPD Commissioner James O’Neill said Friday evening. An assault rifle was found near his body, police said.

“Thank God this was not an act of terrorism,” Mayor Bill de Blasio said from the hospital. “It is an isolated incident and appears to be a workplace-related matter but that makes it no less tragic.”

A 55-year-old woman who was an attending family medicine physician was pronounced dead on the 17th floor, city and hospital officials said. The survivors — one patient, some medical students and doctors — were all hit on the 16th floor and expected to recover from injuries ranging from abdomen to hand wounds, hospital officials said.

The gunman was identified as Henry Bello, 45, who was hired as a house physician in August 2014 but resigned the following February to avoid being fired, said hospital vice president Errol Schneer at a Friday night news conference.

“This was a situation that happened two years ago,” Schneer said, “and unfortunately this individual was able to get into the hospital.”

advertisement | advertise on newsday

Bello’s family could not be immediately reached. His name was not found in the New York State database of licensed doctors.

Online court records show he was charged in 2004 with sexual abuse and unlawful imprisonment, both felonies, and misdemeanor unlawful imprisonment. He pleaded guilty only to the misdemeanor and was sentenced to 28 hours of community service, according to records.

De Blasio said investigators have many questions about what happened, but he and hospital officials praised the response of rescuers and staff on a day that the mayor said went from “normal to horrifying in a matter of seconds.”

Bello had returned Friday to the hospital with the assault rifle hidden under his white lab coat, going up to the 16th floor to target the staff, authorities said. The Associated Press said it was an AR 15.

What came next resembled a “war zone” with a gunman on the loose as the staff rushed the wounded to emergency and operating rooms and tried to evacuate others, said Sridhar Chilimur, the hospital’s chief physician.

Many people inside hid as best as they could for two hours before police could escort them to safety. The noise of the fire alarm and the water from sprinklers added to the tension as police searched for the shooter and firefighters searched for the source of flames.

“It was extraordinarily difficult to see,” said Chilimur. “This didn’t look like a hospital."

Dr. Henry Bello, former employee at Bronx Lebanon Hospital is seen in a photo from his Facebook page. Photo Credit: Facebook

“There’s smoke, there’s water. there’s blood everywhere, and so we have to wade through that and take care of the patients, remove them rapidly, get them into elevators and take them to the operating room, get IVs in and they did that all while the active shooter was still in the building . . . We had cops with drawn weapons everywhere.”

advertisement | advertise on newsday

The gunman was still on the 16th floor when the staff rescued the wounded, including a gastrointestinal surgeon hit in the hand, Chilimuri said.

“They found one of the doctors was still moving with his hand shot so they dragged him out, put him in an elevator, and pressed the button,” the chief physician said. The surgeon was taken to safety on the other floor, officials said.

Police did not immediately say how long the shooting rampage lasted, but as the sounds of gunfire echoed, patients in pain and parents with children feared they wouldn’t be able to get away quick enough.

In the emergency room, armor-clad police with bullet-resistant shields and long guns rushed in, ordering people to put up their hands as they evacuated.

“I thought I was going to die,” said Reynaldo del Villare, 55, of the Bronx, who was waiting to be treated for back pain in the emergency room with about 40 others. “I can’t walk. I can’t run. And you know your life is in danger.”

advertisement | advertise on newsday

Raquel Cotto, 44, stayed inside an examination room in pediatrics with her 1-month-old granddaughter. “I held her close,” she said, recounting hearing nurses screaming that people had been shot.

Authorities shut down surrounding streets, trapping workers in their businesses.

The hospital resumed operations Friday night, except on the two floors affected. Bronx-Lebanon, on the Grand Concourse in the Claremont section, has been serving South and Central Bronx for more than 120 years.

“This was a horrific situation unfolding in the middle of a place that people associate with care and comfort,” de Blasio said. “But even in the midst of this horror, there were several acts of courageous heroism.”

Hospital officials said the injured patient was stable and did not require surgery, while the employees were in serious condition after undergoing the first of multiple surgeries expected for each.

A total of about 50 to 60 people were on the two floors during the shooting, hospital officials said, lauding a staff that had been undergone an active shooter drill just last month.

“As a result of their efforts, there’s only one patient injury,” Schneer said. “All the other patients in this hospital were protected.”

But what happened inside the hospital has made a lasting conclusion with Milagros de Jesus, 49, of the Bronx, who was there with her father, scheduled for an MRI.

She didn’t hear the shots and said she found out about the shooting through an app on her phone.

Said de Jesus, “We’re not safe anywhere, not even in the hospital.”

With Matthew Chayes, Nicole Levy, Maria Alvarez, Mark Morales, Lexi Schapitl, Lauren Cook and Pervaiz Shallwani