This armed thief messed with the wrong guy.

Jauan Blume, 21, and an accomplice allegedly robbed a 32-year-old man of his jewelry in the Bronx on Tuesday and then opened fire on the victim — but the tables were turned when Blume was brutally attacked and left beaten and bloodied by a pack of the victim’s pals in a case of mob justice, police said Friday.

Dramatic video, obtained by The Post, captured the wild incident playing out around 8:20 p.m. on Creston Avenue near East 182nd Street in Fordham Heights, cops said.

Surveillance footage shows Blume, wearing a white shirt, and his pal, in a red shirt, walk up to the victim, who can be seen leaning against a parked car.

Moments later, a struggle ensues between Blume and the victim, who wraps his arms around Blume, dragging him behind the car and into the street, as the suspect in the red shirt can be seen with his arm extended, the video shows.

The victim suffered a gunshot wound to the leg and a graze to his right eyebrow, authorities said.

Blume’s pal can be seen in the footage running over as both the victim and Blume are down on the ground, before the pal flees.

Seconds later, another person jumps into the fracas, followed by nearly 10 more men, who can be seen relentlessly beating the crook, punching him in the face, kicking him and bashing his body.

A graphic 9-second video posted to Snapchat shows a bloodied Blume lying on the ground with his eyes closed as someone kicks him in the face while he is surrounded by several people shouting.

“Thou shall not try to ROB ANYONE ON MY BLOCK with a GUN. Now u LEGEND…Ya other boy ran on you ya big dummy,” the caption on the video reads.

At some point during the melee, Blume was shot in the forearm, and cops believe he accidentally shot himself, authorities said.

The robbery victim took himself to Bronx-Lebanon Hospital for treatment for his gunshot wounds, police said.

Police were called to the scene and Blume was taken into custody.

Emergency responders took Blume to St. Barnabas Hospital for the gunshot wound and trauma to his body, cops said.

On Wednesday, he was hit with felony charges of robbery, assault and criminal possession of a weapon, authorities said.

His accomplice, whose identity was not immediately known, was still at large.

Authorities say they were able to recover the jewelry Blume had swiped from the man.

Police are not seeking any additional suspects in connection with the incident, they said, noting that the robbery victim is cooperating with authorities.