A New York City police officer is receiving praise for using nonlethal force to fend off five menacing, visibly drunk men on a subway platform, according to authorities and video of the incident.

A video of the confrontation Sunday taped by a bystander and posted on social media shows Officer Syed Ali shouting repeatedly: "Stand back. I don't want to hurt you," as the men approached him in unison. The officer brandished his baton, but does not appear to have reached for his service revolver.

His apparent de-escalation of the incident came as some critics of police around the country are urging greater use of nonlethal tactics when possible.

"Officer Ali showed restraint & discipline in how he de-escalated the situation," New York City Councilman Chaim Deutsch, who sits on the council's transportation committee, tweeted. He showed "quick action to defend civilians and himself against five individuals attacking on a subway platform."

Ali's union also praised the "courageous" officer and said the incident could have had a much different, tragic outcome.

“There’s is no telling how much damage these mopes would have done to that courageous police officer had he not been equipped to handle them," Patrick Lynch, president of the city Patrolmen's Benevolent Association, said in a statement. "Had it gone the other way we might have had a seriously injured or dead police officer."

The confrontation began when a woman reported at 10:30 p.m. ET Sunday that she was being sexually harassed by a group of men as she waited for an F train on the Lower East Side of Manhattan, police said. After Ali, on a solo foot patrol, told the five men to leave the station, they became combative and ganged up on him, police said.

Ali kicked at least two of the men as they approached him, the video showed. One of the men stumbled into the tracks during the confrontation before Ali radioed for power to be cut from the tracks to keep away any trains that might hit the man, police said.

Other first responders arrived to rescue the man on the tracks and to take his four cohorts into custody, police said.

The next day, the five men were found at the same station and ticketed for loitering, authorities said.

Initially, Lynch criticized that none of the men were initially charged in the attack.

Later Wednesday night, however, two of the men were arrested. The NYPD identified them as Eliseo Alvarez, 36, who faces charges of attempted assault, riot, obstructing governmental administration, attempted criminal possession of a weapon and menacing, and Juan Nunez, 27, who was charged with obstructing governmental administration and riot.

Both are homeless. None of the other men were in custody, although police said they were looking for another.

A representative for the Manhattan district attorney told NBC News that the men were only booked initially for loitering, and thus prosecutors had no basis to charge them with any more serious crime.

"They were not arrested for anything having to do with the officer, and we did not know that they were suspected of anything other than sleeping on the subway on Dec. 24," said Danny Frost, a spokesman for the district attorney.

"If police had charged them for the conduct in the video or even alerted us that they were involved in a previous altercation with an officer, we would not have declined to prosecute," Frost said.

Two of the five men had outstanding warrants and were kept in custody after Monday's arrests, the deputy chief of staff to City Council member Deutsch said.