Long before Erika Menendez was charged with pushing 46-year-old Sunando Sen to his death under an oncoming train at a Queens elevated station in New York, she had years of contact with the city's mental health and law enforcement establishments.

Menendez, 31, was treated by psychiatric staff of at least two city hospitals and caseworkers visited her family home in Queens to provide further help. She was also arrested at least three times, according to the police, twice after violent confrontations.

Her years of inner and outer turmoil culminated in the deadly assault on the unsuspecting man who was waiting for a train on Thursday.

Beyond stirring fear among riders on crowded platforms across the city, the attack also raised questions about the safeguards in a patchwork private and public mental health system that is supposed to allow mentally ill people to live as freely as possible in the community while protecting them and the public.

A similar attack more than a decade ago led to a law aimed at forcing mentally ill people with a history of violence to undergo treatment, but it is widely acknowledged to cover only a small portion of those who need help.

Executive director of the Mental Illness Policy Organization D.J. Jaffe said thousands of troubled individuals with violent histories were released from mental health facilities and, beyond requiring that they have a home to go to and an outpatient care plan in place, there is little oversight of their activities.

“No one monitors if they are taking their medication,” he said. “Or follows up to see if they are a danger to themselves or others.”

Menendez’s case puts renewed attention on a mental health system that is a loose amalgam of hospitals, supported housing, shelters and other advocacy and support groups, in which mentally ill people often bounce from one to the other and ultimately fall through the cracks. It is not known precisely where Menendez fit in.

City officials said it would be misleading to conclude that anyone was at fault in her treatment.

“People get well and then they get sick again,” Ana Marengo, a spokeswoman for the city’s Health and Hospitals Corp. that runs Bellevue and Elmhurst Hospital Centers, said Sunday.

Menendez was treated at both hospitals, according to friends and law enforcement officials.

Ms. Marengo declined to confirm or deny whether Menendez was treated at either hospital, citing confidentiality rules, but said that patients treated at city hospitals often were discharged into the care of outpatient mental health providers. The fragility of the system could be seen in the aftermath of Hurricane Sandy, when Bellevue Hospital Center, a public hospital that treats many of the city’s most seriously ill patients, was forced to evacuate and close.