A doctor forced out of a New York City hospital over sexual harassment claims returned with an assault rifle hidden under a lab coat and shot seven people, killing a woman medic and leaving several of her colleagues fighting for their lives.
The gunman, Dr Henry Bello, 45, then took his own life after trying to set himself on fire at Bronx Lebanon Hospital.
He staggered, bleeding, into a hallway where he collapsed and died with the rifle at his side, authorities said.
Witnesses described a chaotic scene as gunfire erupted spreading terror throughout the hospital as employees locked themselves inside rooms and patients feared for their lives.
"I thought I was going to die," said Renaldo Del Villar, a patient in the third-floor emergency room who was being treated for a lower back injury.
Officials said Bello, described on the hospital website as a family medicine physician, used an AR-15 assault rifle in the attack on the 16th and 17th floors.
Bello was allowed to resign from the hospital in 2015 amid sexual harassment allegations, according to two law enforcement officials.
In unrelated cases, the doctor had been arrested in 2004 on a charge of sexual abuse, according to a police report, after a 23-year-old woman told police Bello grabbed her, lifted her up and carried her off, saying: "You're coming with me."
He was arrested again in 2009 on a charge of unlawful surveillance, after two women reported he was trying to look up their skirts with a mirror.
The woman doctor was killed and six others wounded, five seriously, said police commissioner James O'Neill. The patients were treated in the emergency room at Bronx Lebanon.
"This was a horrible situation unfolding in a place that people associated with care and comfort, a situation that came out of nowhere," New York mayor Bill de Blasio said.
Shortly after receiving a 911 call about an active shooter, police officers went floor by floor, their guns drawn, looking for the gunman.
They later learned he was dead inside the building.
Bello may have doused himself with an accelerant like petrol and tried to set himself on fire before shooting himself, officials said. Sprinklers extinguished the fire.
According to New York State Education Department records, Bello had a limited permit to practise as an international medical graduate to gain experience in order to be licensed. The permit was issued on July 1 2014, and expired last year on the same day.
A former colleague described Bello as a problematic employee.
He "was very aggressive, talking loudly, threatening people. All the time he was a problem", said Dr David Lazala, a family medicine doctor who said he trained Bello at Bronx Lebanon.
He said Bello, who worked at night, sent him a threatening email after he left.
Employees and their loved ones described the horrifying moments as they scrambled for information.
Garry Trimble said his fiancee, hospital employee Denise Brown, called him from inside the building to tell him about the gunman.
"She woke me up and told me there was a situation, somebody's out there shooting people," Mr Trimble said.
"I could hear in her voice she was shaking and about to cry."
Gonzalo Carazo told WCBS-TV: "I saw one of the doctors and he had a gunshot wound to his hand.
"All I heard was a doctor saying, 'Help, help!'.
Mr Carazo locked himself in a room for about 15 minutes until police came and led him out of the hospital.
The 120-year-old hospital has one of the busiest emergency rooms in New York City. The campus where Friday's attack took place, about a mile and a half north of Yankee Stadium, has 415 beds.
In 2011, two people were shot at Bronx Lebanon in what police said was a gang-related attack.