When a group of protesters arrived on the steps of a California courthouse this week to protest the pretrial of an officer charged with killing a Black man in a Walmart last year, they weren't expecting to be serenaded with a Taylor SwiftTaylor Alison SwiftBlackburn: 'Taylor Swift would be the first victim' of socialism, Marxism California police officer plays Taylor Swift to prevent protesters' video from being posted to YouTube The Hill's 12:30 Report - Presented by Facebook - Social media flooded with 'ring of fire' eclipse photos MORE song.

In a video that has been widely circulated on social media, Sgt. David Shelby is seen responding to protesters recording him as he confronts them over their placement of a banner by blasting Swift’s 2014 hit single “Blank Space" from his cellphone.

During the confrontation on Tuesday, Shelby goes back and forth with James Burch, policy director for the Anti Police-Terror Project and one of several activists who filmed the officer.

ADVERTISEMENT

“Are we having a dance party?” Burch asks Shelby after he turns on the tune in the middle of their conversation.

“You can record all you want, I just know it can’t be posted on YouTube," Shelby responds, referring to the social media giant's automated system that detects copyrighted material and removes it from the platform.

Despite Shelby's efforts, the video shared by the Anti Police-Terror Project, an organization that seeks to hold officers accountable, gained more than 174,000 views on YouTube and had more than 769,000 views on Twitter on Friday afternoon.

"A cop demanded we move #Justice4StevenTaylor banners. We asked him why. He pulled out his phone & played a Taylor Swift song," the Anti Police-Terror Project wrote in a caption of the video.

The Alameda County sheriff's office acknowledged that Shelby's actions did not have his desired effect, according to The Washington Post.

“The officer was trying to be a little smart, and it kind of backfired,” Sgt. Ray Kelly, a sheriff’s office spokesman, told the Post. “Instead of censoring it, it made it go viral.”

Kelly told the news outlet that Shelby is still on duty but the incident is being investigated. He also added that while there isn't a set policy banning the officer's actions, the sheriff's office did not “condone” his behavior.

“This is not a good look for law enforcement,” he said. There is a “serious lesson learned here."