FRESNO, California — A robbery attempt at a California Starbucks turned into an epic beatdown when a 58-year-old customer began wailing at a wannabe thief nearly half his age with a chair.

Surveillance video footage released by the Fresno police shows hero coffee lover, Cregg Jerri, dart up behind a man wearing a Transformer mask, carrying a knife and a replica gun as he menaced the barista, and brain him with the chair.

The initial blow sent the mask flying off of 30-year-old Ryan Michael Florez’s head, triggering a scuffle between the two men that left both of them with stab wounds.

Police say Florez later tried to claim that he was the victim of a robbery to explain away the stab wounds he received during the fight, but that he was ultimately charged with attempted armed robbery and assault with a deadly weapon.

https://www.youtube.com/watch?v=B3cpqq4uPc0 Video can’t be loaded: Customer takes on armed robber at Northwest Fresno Starbucks (https://www.youtube.com/watch?v=B3cpqq4uPc0)

The wild episode erupted Thursday, when Florez allegedly charged into the Starbucks wearing the mask and brandishing the weapons and demanding cash.

Jerri, who is a regular customer and knows the baristas well, was seated nearby and calmly grabbed a chair and ran up behind Florez and slammed him over the head twice.

The two then rumbled throughout the store, with Jerri suffered cuts to his hands, but eventually wrestling away the knife and using it to stab Florez in the face and torso. He fled the scene but was soon arrested after being spotted bleeding as he walked along a nearby canal.

Police called Jerri a “courageous hero.