The Republican Party characterizes itself as the party of the Constitution. But on the eve of the vice presidential debate, it decided to attack Democratic vice presidential nominee Tim Kaine for carrying out a constitutional duty.

The Republican National Committee debuted a TV ad Monday that attacks Kaine for representing convicted criminals as a civil rights lawyer in Richmond (as well as selectively highlighting his record as governor to make him seem more generous with clemency than he actually was).

As the ad’s narration puts it, Kaine “constantly protected the worst kinds of people.”

Sure he did. Someone had to. The Constitution says so.

Attacking Kaine for fulfilling a constitutional duty isn’t just an expression of hypocrisy, though. The ad — and its bungled rollout — are the clearest sign yet that Republicans who’ve embraced criminal justice reform, and tried to move past racially polarizing “tough on crime” politics, have lost the battle for the soul of their party.

Republicans had started to back away from these kinds of racialized attacks — but this is a sign they haven’t been stamped out

“Criminals are bad, and Democrats like criminals” is a well-established genre of Republican attack ad. So it’s no surprise that when the Kaine ad was released on Monday, Roll Call, the outlet that obtained “exclusive” right to the ad, billed it as a “Willie Horton–style” attack.

But the conventional wisdom on this type of attack has changed — not least because in 2016, many people understand the racial undertones in portraying Democrats as coddling “criminals.” When the GOP tried a similar attack on Kaine during his 2005 race for Virginia governor, as pointed out by Democratic strategist Mo Elleithee (who worked on Kaine’s campaign), not only did it not work, but it also helped turn voters against his opponent.

That put the RNC in an awkward position — and made the ad’s rollout (as Politico noticed) seem somewhere between “bungled” and “unintentionally comical.” The RNC and its communications director Sean Spicer both tweeted out the Roll Call article (with apparent pride).

Then, as other Republicans recoiled from the suggestion that a “Willie Horton–style attack” was somehow an okay thing to do, the RNC and Spicer deleted the tweets — and Spicer started demanding that Roll Call issue a correction to change the headline he’d tweeted out himself just hours before.

In fairness to the RNC, the anti-Kaine attack ad stays away from the racialized images of “scary black men” that the Horton ad (and its descendants) so freely trafficked in. Most of the criminals featured in the Kaine ad are white. But the reason that “law and order” is such a powerful trope to begin with is because of fears of lawless nonwhites — something the Republican Party’s current presidential nominee understands extremely well.

It’s sad to see this. For a few years, it looked like the Republican Party — or at least one wing of it — was beginning to figure out a way to talk about the criminal justice system that avoided racial polarization.

Reformers at the state level, and senators like Rand Paul and Mike Lee, talked about the need for criminal justice reform as a fiscal, moral, and, yes, constitutional matter. They deserve a lot of credit for putting reform on the national agenda. They’ve helped bring some of their own party’s skeptics on board — and have helped inspire Democrats to move past their own tough-on-crime traditions. Some have even addressed the right to counsel itself: Republican megadonors Charles and David Koch fund scholarships and training for future public defenders.

But it looks like Republican reformers have lost the fight within their own party.

Tim Kaine was fulfilling a constitutionally required role

The anti-Kaine attack ad might not be as racially grotesque as the Willie Horton ad. But its message is arguably even more horrifying. Instead of attacking a particular clemency policy, it attacks the right to counsel itself.

The right to counsel is a constitutional guarantee. Period. It’s right there in the Sixth Amendment (emphasis added):

In all criminal prosecutions, the accused shall enjoy the right to a speedy and public trial, by an impartial jury of the state and district wherein the crime shall have been committed, which district shall have been previously ascertained by law, and to be informed of the nature and cause of the accusation; to be confronted with the witnesses against him; to have compulsory process for obtaining witnesses in his favor, and to have the assistance of counsel for his defense.

The Supreme Court hasn’t always agreed on the scope of the right to counsel: Only in the mid-20th century did it decide that defendants who couldn’t afford to hire lawyers had the right to public defenders. But the basic fact of it is pretty inviolable. There is no crime so heinous in the US court system that a lawyer is not permitted — even obligated — to speak in its defense.

Tim Kaine wasn’t a public defender; he was a civil rights lawyer who often took on appeals for convicted criminals facing the death penalty. (This Newsweek profile of Kaine by Emily Cadei discusses his decision to take on cases like this.)

That’s a type of “criminal prosecution.” His clients had the right to counsel.

Kaine didn’t have to choose to defend them himself, but someone would end up having to defend them. Kaine decided to be the person who’d fulfill that constitutional duty. And now he’s getting attacked for it.

The constitutional right to counsel is being eroded because of political disgust-mongering like this

This isn’t the first time that defending “the worst kinds of people” has become a political liability in later life. Earlier this cycle, Hillary Clinton was attacked for representing a rapist early in her own law career.

Inevitably, this becomes a factor in judicial appointments themselves. Barack Obama reportedly passed over Judge Jane Kelly of the Eighth Circuit for his latest Supreme Court appointment slot because of the attacks that were already being rolled out against her for representing violent criminals as a public defender. (He went with the centrist, tough-on-crime Merrick Garland instead.)

This has real consequences. The Supreme Court hasn’t had a criminal defense lawyer as a member in a quarter-century. Over that time, it’s eroded defendants’ rights — including the right to counsel.

Furthermore, when it’s common to attack a politician or judge for once having represented bad people in court, young lawyers who want to be politicians or judges in later life are likely to avoid becoming criminal defenders. They just won’t want to risk it.

That deprives defendants of good counsel; it means that politicians and judges don’t understand the criminal justice system from the point of view of the accused; and it makes them all the more likely to demonize lawyers, like Tim Kaine, who choose to step into the role that the Constitution demands.

Republican reformers could stop this vicious cycle if they could get their party to stop treating constitutional rights as an election year wedge issue. But as long as the Republican Party, in even-numbered years, attacks people for representing violent criminals in court, it’s not going to be able to pressure its elected officials and its base to support criminal justice reforms in odd-numbered ones.

The racial politics of Trumpism are potent, and it’s hard to imagine they’ll be fumigated from the Republican Party even if Trump loses. The criminal justice reform wing of the GOP will be one casualty. The Constitution — or at least the Sixth Amendment — might be another.