Alan and Alex Stokes, twin brothers who run a popular YouTube prank-video channel, pleaded guilty to misdemeanor charges of false imprisonment and reporting false emergencies in connection with a pair of fake bank robberies in 2019, Orange County prosecutors said.

The charges stemmed from stunts the brothers carried out in Irvine, Calif., on Oct. 15, 2019. According to authorities, the Stokes brothers — dressed all in black, wearing ski masks and carrying duffle bags full of cash as they pretended they had just robbed a bank while their videographer filmed it — ordered an Uber.

When they got into the car, the Uber driver, who was unaware of the prank, refused to drive them. A bystander notified the cops, and when Irvine police arrived they ordered the Uber driver out at gunpoint. He was released after police determined he was not involved.

Police issued a warning to the Stokes brothers and let them go. But, according to prosecutors, four hours later, the twins carried out the same kind of prank on the campus of the University of California, Irvine — resulting again in 911 calls regarding a potential bank robbery.

Authorities had originally charged the 23-year-old twins with a felony count of false imprisonment. The judge reduced that charge to a misdemeanor in exchange for their guilty pleas, according to prosecutors.

The Stokes twins did not respond to a request for comment sent to an email listed on their YouTube channel.

After entering guilty pleas on Wednesday, the Stokes brothers were each sentenced to 160 hours of community service, one year formal probation and ordered to pay restitution. The judge also ordered the brothers to stay away from the University of Irvine and to “stop making videos that mimic criminal behavior.”

“These crimes could have easily resulted in someone being seriously hurt or killed,” Orange County DA Todd Spitzer said in a statement. “An active bank robbery is not a casual police response and these police officers were literally risking their lives to help people they believed were in danger. It is irresponsible and reckless that these two individuals cared more about increasing their number of followers on the internet than the safety of those police officers or the safety of the innocent Uber driver who was ordered out of his car at gunpoint.”

Among their acting credits, the brothers had brief roles in Hulu’s “Light as a Feather” Season 2.