Inside a subway station in Lower Manhattan, a group of police officers slowly followed a disheveled man in a soiled gray sweatshirt who was stammering and thrashing his arms wildly.

“Please, leave me alone,” he shouted. He thumped his chest with an open palm and then, growing exasperated, sat down on a staircase. “What did I do wrong?”

Mucus had crusted in his beard. A pair of stained pants hung off his slender frame.

“Come on,” one officer, Heather Cicinnati, said as the man stumbled forward, disoriented and agitated. “We’ve got to leave the station.”

The police officers were part of a team led by a medical worker whose job is to move — by force, if needed — mentally ill people, who are often homeless, out of New York City’s transit system. On that brisk March morning, the team handcuffed him and dragged him out of the subway station. Then, they placed a white spit hood over his head.

The intervention teams are part of an expansive effort to make the subway safer after a string of shocking crimes. Part of the plan involves finding solutions to one of the transit system’s most frustrating problems: people experiencing mental health issues and homelessness living on trains and in stations.

Officials with the Metropolitan Transportation Authority, which operates the subway, said they were doing what was necessary to help troubled people while keeping them away from passengers. In survey after survey, riders have said they would use mass transit more often if they saw fewer people behaving erratically and more police officers.