Jesus said, “Do to others as you would have them do unto you.”

If this guy had heeded Jesus’ word, he might not have wound up handcuffed and bleeding on the asphalt.

San Diego police said a man tried to carjack a woman and her daughter at gunpoint on Sunday, successfully getting into the woman’s minivan and preparing to drive off.

But as video posted to YouTube shows, a crowd of bystanders came together to thwart him.

Image source: screengrab via YouTube

Image source: YouTube

In the video, the crowd drags the suspect out of the vehicle, holding him down and beating him so he can’t get away.

When a police officer shows up, the man appears to resist arrest, and the bystanders once again lend their hands.

“Put your hands behind your back,” the officer commands.

He’s quickly echoed by a civilian who’s jumped back in to help: “Put your hands behind your f***ing back!”

Image source: screengrab via YouTube

Image source: YouTube

“He just opened up the back door and jumped in,” another bystander said.

Police identified the suspect as 21-year-old Ismael Herendez, KGTV-TV reported.

The victims were examined by paramedics and found not to be seriously injured, KGTV reported. Herendez was booked into the San Diego County Jail.

Watch the full encounter here (content warning: strong language and violence):

Follow Zach Noble (@thezachnoble) on Twitter