Three drunk homeless men who attacked a cop on a New York City subway platform in a viral video are now facing riot charges after union outcry when they were initially released without charge.

Eliseo Alvarez, 36, has been charged with attempted assault, riot, menacing, and other charges. Juan Nunez, 27, was also charged with obstructing governmental administration and riot charges.

A third will face those counts and attempted assault.

The men were among five vagrants who attacked NYPD Officer Syed Ali, a combat veteran of Afghanistan and Iraq, at the East Broadway subway station on Saturday night.

Video of the incident, which has since been viewed more than 4.75 million times on social media, showed Ali using a baton and kicking at the men as they come at him. One of the men who charged at the officer missed and fell onto the tracks.

Two other men in the video appeared to be trying to break up the scuffle. They haven't been charged.

The homeless men that were involved in the attack on Officer Syed Ali were initially arrested on illegal sleeping charges, but not for assaulting the cop earlier

Video shows a group of five homeless men in a confrontation with a NYC cop Sunday

Councilman Chaim Deutsch (2nd from right) visits NYPD Transit Task Force to thank Officer Syed Ali (2nd from left) for his quick action to defend civilians and himself

The NYPD initially only sent the men to the hospital for signs of extreme drunkenness, but after they were released, they returned to the East Broadway station to sleep.

Police then only initially cited the men for sleeping on the station floor. The Manhattan District Attorney's stopped prosecuting such violations in 2016.

The charges announced Wednesday come after criticism from a police union.

A New York City police union was upset that prosecutors did not bring criminal charges against the homeless men attacked the officer on a subway platform.

The officer kicks one man and swats the baton at another when they approach

One of the vagrants lunged toward the officer, missed and fell on the tracks

The Manhattan District Attorney's office blames police, saying the men 'were not arrested for attacking an officer' in Sunday night's incident at the East Broadway station.

A spokesman for DA Cyrus Vance Jr. said that the office would not have declined to prosecute the men if it had known about the other allegations, the New York Post reported.

Police only cited the men for sleeping on the station floor, and the DA stopped prosecuting such low-level violations in 2016.

Patrolmen's Benevolent Association President Patrick Lynch says the DA's job 'is to prosecute crimes, not to act like a social advocate.'