NEW DELHI — Whether he was killed or committed suicide, the jailhouse death Monday of a man on trial for the gang rape and fatal beating of a woman on a New Delhi bus has triggered shock at the enormous security failure at one of India’s best-known prisons.

Authorities said Ram Singh, who was accused of driving the bus during the December attack, was in a cell with three other inmates at Tihar Jail in New Delhi when he hanged himself either with his own clothes or a bedsheet about 5:30 a.m.

“This is suicide,” Home Minister Sushilkumar Shinde said.

His family and lawyer alleged foul play.

“There were no circumstances which could have led to Ram Singh committing suicide. There was no mental stress. He was very happy (about the trial’s course),” his lawyer V.K. Anand said.

Singh, 33, had been among five defendants facing the death penalty if convicted of the rape attack, which horrified Indians and set off national protests. A sixth accused is being tried and jailed separately because he is a juvenile.

Singh’s death in custody raised further questions about a criminal justice system already under attack for failing to protect the nation’s women.

“It’s a major lapse.” said Shinde, the nation’s top law enforcement official.

The government had ordered a magistrate’s inquiry and would take action after it received the report, he said.

Kiran Bedi, the former director of the jail and now an activist, said prison officials had a moral and legal obligation to ensure Singh’s safety, and she expressed surprise that authorities had not been monitoring him with cameras. “You are duty bound to protect the lives of the prisoners,” she said.

Ram Singh’s father, Mangelal Singh, said his son had been raped in prison by other inmates. Nevertheless, he said he visited his son four days ago and his son did not seem suicidal.