Sure it was repugnant, this slop bucket of racist humor and porn culled from the email correspondence of Miami Beach police officers.

But what made this all the more shocking was the senders’ seeming lack of self-awareness. Most of this stuff emanated from the computers of a major and a captain, ranking officers whose standing conferred a presumption that they should have had at least an inkling that times have changed. Even in the Miami Beach PD.

Yet these two supervisors in a supposedly modern police force, Maj. Angel Vasquez and Capt. Alex Carulo, used a digital medium to convey their vulgarities. As if they were too inane to realize the viral potential of such content, volatile enough to get them fired and sabotage the entire department’s credibility.

Indeed, Vasquez and Carulo are out of the department. The major was pushed into retirement. Carulo was fired Thursday morning. But their racist and pornographic missives are now everywhere there’s a Wi-Fi connection, stirring up a dangerous stew of mistrust and animosity just as their fellow officers prepare for an influx of thousands of young black tourists heading to Miami Beach for Urban Beach Week. (Adding to the volatility, Vasquez is also under investigation for an email including the autopsy photo of Raymond Herisse, a young black motorist killed in a controversial police shooting during the Urban Beach Week celebration in 2011.)

Premium content for only $0.99

“Not only are we all offended by these emails, but this conduct seems to have been accepted by the department and permeated the highest ranks,” said State Attorney Katherine Fernandez Rundle at a packed news conference at her office on Thursday.

Miami Beach Police Chief Dan Oates, who took over the scandal-plagued department last year, told reporters that his predecessor, Ray Martinez, had known about the unseemly emails, dated from 2010 to 2012. Internal affairs investigators had traced five of them to Martinez’s very in-box. Yet Martinez had essentially shrugged them off after writing a tepid single-page memorandum noting that Vazquez had been “counseled.”

Again, it was not just that the then-chief should have been personally offended by the juvenile and boorish content, particularly coming from ranking officers. Martinez (who has since slunk off into retirement) didn’t seem to foresee the potential damage this stuff could cause the Miami Beach PD.

Chief Oates (who must be wondering what the hell he got himself into after leaving the police chief post in Aurora, Colorado) twice called the email scandal a “failure of accountability and leadership.”

And it was. But the Miami Beach embarrassment also included another recurring theme in recent police scandals — this knuckle-headed failure to recognize that in the 21st century, it’s all out there, reverberating around the Internet. To read on the websites. To watch on YouTube.

That startling 2013 video, now widely circulated, of the very muscular Miami Beach police detective Philippe Archer striking a handcuffed young woman with a round-house punch, followed by a kick, was brutally offensive to watch. But it was even more stunning to consider that this veteran cop delivered the beating in full view of the surveillance cameras mounted over the PD parking garage. For all the world to see.

Archer got off with an outrageously mild 30-day suspension (without pay.) His official reprimand read, “Your lack of judgment and your poor decisions defy your tenure as a Miami Beach Police officer of 19 years.” It was almost as if there was a double meaning. Because how could a 19-year-veteran not know, as he beat that slight, helpless woman, that he was creating a YouTube sensation?

How could modern police officers not know that, in an age when a careless tweet can undo a politician’s career, a video showing unprovoked brutality or deadly force can get a police officer fired or indicted? Or that disgusting emails can cause all manner of repercussions?

In March, four Fort Lauderdale police officers were fired for circulating a racist video and text messages denigrating President Barack Obama and other minorities, including some fellow police officers. The official report noted, “The messages criticized their coworkers’ grammar, appearance, work ethic and referred to an entire shift as lazy (expletives). … The officers also exchanged text messages that included derogatory comments towards Hispanics and homosexuals.”

The Fort Lauderdale episode meant more than departmental embarrassment. Prosecutors tossed 34 criminal cases, including 11 felonies, in which these four cops were the arresting officers — so far. State Attorney Fernandez Rundle said Thursday that her office was sorting through 540 cases involving the 16 Miami Beach police officers who either sent or were recipients of 230 offensive messages or images emailed through the department’s server. She said 162 of those cases under review involved black defendants.

Most involved misdemeanors, but some were felonies. Which means there were real victims of real crimes that could now go unpunished. Because a few cops, as Fernandez Rundle put it, indulged in “juvenile behavior and locker-room mentality.”

Make that juvenile behavior, locker-room mentality and an oafish obliviousness to the cascading consequences such inanity provokes in the digital age.