A former St. Louis cop pleaded guilty in federal court Friday to assaulting a fellow officer who he thought was a demonstrator during a protest in 2017, according to the Department of Justice.

Randy Hays, 32, faces one count of using unreasonable and excessive force against another St. Louis Metropolitan Police Department (SLMPD) officer.

Luther Hall, the officer said to have been mistaken for a demonstrator, was undercover during protests in downtown St. Louis over the acquittal of a former SLMPD officer, Jason Stockley, on a state murder charge, the DOJ said.

Stockley was captured on a dashcam fatally shooting Anthony Lamar Smith. Stockley’s acquittal sparked weeks of protests, prompting the use of the SLMPD’s Civil Disobedience Team.

Officers Hays, Bailey Colletta, Dustin Boone, and Christopher Myers were on that team when they reportedly mistook the undercover officer for a protester, beat him, then tried to cover it up, St. Louis’ Fox 2 reported.

Text messages cited by the station were instrumental in their indictment, which said the officers “expressed disdain for the Stockley protesters and excitement about using force against them and going undetected while doing so.”

Federal authorities also captured a text from Hays which allegedly read “Going rogue does feel good,” Fox 2 reported.

OKLAHOMA POLICE CHIEF IN FLORIDA FOR CONFERENCE ALLEGEDLY KILLED BY FELLOW OFFICER

Colletta pleaded guilty in September to committing perjury in connection with the assault. Boone and Myers remain under indictment on federal charges. Both have pleaded not guilty. Their trial is scheduled for early next month.

CLICK HERE TO GET THE FOX NEWS APP

Per Hays’ plea agreement, he must forfeit his law enforcement certification in addition to facing a maximum 10-year prison sentence. No sentencing date has been scheduled.