By Police1 Staff

BIRMINGHAM, Ala. — A suspect who pistol-whipped an officer until he was unconscious with his own service weapon has been charged with attempted murder, and the attack was celebrated by commenters on social media, Alabama.com reported.

Janard Shamar Cunningham, 34, stole the detective’s weapon, then pistol-whipped and repeatedly hit him in the head after he was pulled over for questioning. The detective’s name has not been released, but he is already out of the hospital and recovering at home with his family, according to the publication.

Shortly after the attack, photos taken by bystanders were posted on social media showing the detective lying in a pool of his own blood. Most of the comments praised the man who beat the officer. The department is outraged by the public support of the incident.

"He was laying there lifeless and people were standing around taking pictures,'' said Birmingham police Sgt. Heath Boackle, president of the Fraternal Order of Police. "If the tables were turned, and that was a suspect lying there, they would be rioting."

The incident began when the plainclothes detective in an unmarked car stopped Cunningham’s SUV in connection with some burglaries in the area. When he approached, he asked the suspect to stay in his vehicle while he waited for backup.

The suspect refused to comply with the officer’s commands, approached the officer and questioned him about why he was being stopped. A fight ensued and the suspect assaulted the detective with his own weapon.

The detective was rushed to the hospital and backup pursued the suspect. He was arrested along with a second man. The second man has not yet been charged with any crime.

Cunningham has a long criminal history dating back to 1999 that includes charges such as assault, robbery, attempted murder, breaking and entering a vehicle, receiving stolen property and disorderly conduct. He was recently arrested in June for driving without a license.

"The boots-on-the-ground officers across this country are at war, and if we do not have the help of citizens and local governments to stand behind us, we'll never win," Boackle told Alabama.com.