Fresh anxiety and tragedy  enveloped the hospital, as his colleague doctors and patients were not spare from the brazen attack. A Nigerian medical doctor forcedout  from a  New York hospital because of sexual harassment accusations returned Friday with an assault rifle hidden under a lab coat and shot seven people, killing one woman, authorities said.

The gunman, Dr Henry Bello, fatally shot himself after trying to set himself on fire at Bronx Lebanon Hospital, officials said. He staggered, bleeding, into a hallway where he collapsed and died with the rifle at his side.

Witnesses described a chaotic scene as gunfire erupted, spreading terror throughout the medical facility as employees locked themselves inside rooms and patients feared for their lives.

Law enforcement officials identified the shooter as the 45-year-old Bello, who was described on the hospital website as a family medicine physician. Officials said Bello 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. The officials didn’t know the details of the allegations.

The officials were not authorized to discuss the investigation and spoke on condition of anonymity.

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 different women reported he was trying to look up their skirts with a mirror.

One female doctor was killed. Six people were wounded, five seriously, according to police commissioner James O’Neill. The patients were treated in the emergency room at Bronx Lebanon.

At a brief news conference on Friday evening, O’Neill said that the hospital’s fire alarm systems were activated “by the suspect’s attempt to set himself on fire”. He may have doused himself with an accelerant such as gasoline and tried to set himself on fire before shooting himself, officials said. Sprinklers extinguished the fire.

New York mayor Bill de Blasio told reporters that “even amidst this horror there were many, many acts of heroism” from first responders and hospital staff during a “the fire that complicated matters”.

As there was “a lot that we are piecing together”, the mayor said, officials would not be answering press questions immediately.

O’Neill said a 911 call was received at 2.55pm, saying a male gunman had opened fire on the 16th floor of the Bronx Lebanon hospital center. The department’s “active shooter protocol” was initiated, he said, leading to the evacuation of the hospital. Police officers went floor by floor, their guns drawn, looking for the gunman. They later learned he was dead inside the building. De Blasio confirmed that Bello killed himself.

As dusk fell, the hospital remained ringed by law enforcement officers. Workers and local residents said the incident had put the community on edge.

“If he wanted to kill himself he should have just gone ahead and done it,” said one ‎nurse who declined to be identified, “and not tried to take other people with him”.

“Everybody is shocked right now,” said student Mohammed Doukoure, 26. “A lot of people don’t trust the Bronx but random shootings don’t happen too often.”

Earlier, as the shooting unfolded, television images had shown the hospital surrounded by police cars and fire trucks. Police could be seen on the roof of the building with their guns drawn.

A law enforcement official speaking anonymously told the Associated Press emergency crews had been kept from going inside the hospital while the shooter was at large.

According to an account Felix Puno, who identified himself as patient in the radiology department on the fourth floor of the hospital, police conducted a room-by-room search, telling civilians to turn off the lights and remain in place.

“Building is in complete shut down, I was in the middle of getting an x-ray when security alerted us to the active shooter situation,” Puno tweeted.

Bronx Lebanon hospital center describes itself as the largest voluntary, not-for-profit healthcare system in the south and central Bronx. The 120-year-old hospital has nearly 1,000 beds spread across multiple units. Its emergency room is among the busiest in New York City.