Since his landslide election in 2014, Texas attorney general Ken Paxton has been a preeminent advocate for state sovereignty. The Republican has led numerous multi-state coalitions in litigation to resist federal overreach, winning significant courtroom victories against the Obama administration. Paxton’s office has also vigorously defended popular laws passed by the Texas legislature—such as voter ID, abortion restrictions, and a ban on sanctuary cities—from lawsuits by liberal groups. In the conservative stronghold of Texas, Paxton’s impressive record as attorney general should make him a hero, and possibly position him for higher elective office—as it did for fellow Republicans, such as current Texas governor Greg Abbott and U.S. senator John Cornyn.

Yet, as I reported earlier this year, Paxton’s reputation has been marred by a dubious felony indictment issued in July 2015, which, after extensive machinations, is now scheduled for trial on December 11. The case, which concerns Paxton’s private work as an investment adviser, has been termed a “political prosecution” by the Wall Street Journal. The trumped-up controversy has regrettably diverted attention from Paxton’s formidable record and—possibly by design—even prompted speculation whether he will survive as an elected official.

In a state notorious for partisan witch hunts against GOP officials—the baseless prosecution of former House majority leader Tom DeLay and former governor Rick Perry are just two examples—the bogus charges against Paxton set a new standard for vindictive criminal proceedings. What makes the Paxton case unusual is that, unlike the attempts to railroad DeLay and Perry by liberal prosecutors in Democrat-controlled Travis County (home of the state capital, Austin), Paxton was indicted in conservative Collin County, a Dallas suburb in which the attorney general enjoys overwhelming support, and which he previously represented for over a decade in the state legislature.

None of the three charges lodged against Paxton pertain to his duties as an elected official. Rather, they arise from events that occurred in 2011 and 2012, when he was an estate-planning lawyer serving part-time in the legislature. How could a powerful statewide official become targeted in his home county? The answer is a sobering lesson in political hardball.

Unfortunately, partisan disputes are not the only driver of political vendettas. Intra-party grudges can be even more rancorous, especially in a one-party state. In this case, moderate (or “establishment”) Republicans associated with Texas House speaker Joe Straus have set their sights on Paxton, a Tea Party favorite backed by social conservatives and evangelicals. The charges against Paxton smack of payback, and the warring factions within the GOP exist even in Collin County. While serving in the state House, Paxton unsuccessfully challenged Straus as speaker, and he later defeated an establishment rival for the coveted GOP nomination for attorney general. Paxton’s adversaries want to discredit him, using contrived criminal charges.

One of the charges is an inadvertent paperwork violation—failing to register as a “representative” when Paxton referred clients to a third-party investment adviser in 2011—for which he has already paid a $1,000 administrative fine. No one in Texas has previously been criminally prosecuted following such a settlement. Paxton also faces two equally flimsy first-degree felony charges, each potentially punishable by up to 99 years in prison, for failing to inform investors whom he was recruiting for a local technology company in 2012 that he had received stock in the company as compensation for his efforts. Investors allegedly assumed that Paxton had purchased his shares. Prosecutors contend that his silence on the matter constitutes criminal fraud. Parallel charges of federal securities fraud, filed against Paxton by the Securities and Exchange Commission based on this unprecedented theory, have already been twice dismissed by an Obama-appointed judge.

How has such a meager scenario evolved into an inquisition worthy of Inspector Javert? Tellingly, one of the allegedly defrauded investors is a veteran legislator, Representative Byron Cook, who happens to be one of Speaker Straus’s key lieutenants. The proceedings began to spiral out of control in early 2015, when the Collin County district attorney, a longtime Paxton friend and business associate, recused himself from the case. Instead of referring the case to an adjacent county’s D.A., as is customary, a Collin County district judge—whom Paxton supporters accuse of bias—hired criminal defense lawyers in private practice from Houston to serve as “special prosecutors,” at the rate of $300 an hour, to be paid by Collin County taxpayers. (Due to a change in Texas law that took effect a few weeks after Paxton was indicted, referral to an adjacent county in such circumstances is now required; appointment of special prosecutors is not an option.)

Despite local rules restricting sums paid to court-appointed counsel to a flat rate of $3,000, Paxton’s three mercenary prosecutors—unelected and unaccountable—racked up over $500,000 in billings before the trial even began. After the trio managed to wrangle an indictment—ham-sandwich style—from a Collin County grand jury, they successfully moved to have the case transferred out of the county on the novel grounds that pretrial publicity favorable to Paxton would make it difficult for them to obtain a conviction. Remarkably, the prosecutors had the temerity to request a change of venue, and alas, a prosecution-friendly trial judge (subsequently removed from the case) ordered the case moved to faraway Harris County, which includes Houston. Harris has a heavy Democratic tilt and also happens to be the county in which the prosecutors live and work.

For a while, it seemed as if nothing would break in Paxton’s favor. He faced a series of one-sided trial-court rulings, rogue prosecutors with unlimited budgets, scathing media coverage from Texas’s liberal press corps, and fruitless pretrial appeals. Paxton, who has to finance his defense with personal savings and gifts from friends, seemed to be trapped in a hopeless Star Chamber.

In June, however, Paxton’s prospects began to improve when the Court of Criminal Appeals removed the longstanding trial-court judge. More importantly, as a result of a taxpayer lawsuit objecting to Collin County’s excessive (and open-ended) payment of “special prosecutors,” the Fifth Court of Appeals ruled in August that further payments would be unlawful, despite a pending invoice from Paxton’s inquisitors for $205,000. The special prosecutors have appealed the ruling and may seek to withdraw from the case absent an assurance they will be paid. In the meantime, Collin County is seeking reimbursement for the $370,000 already paid to the Houston lawyers. The tables have been turned.

Paxton’s ordeal is not yet over, but unless the Court of Criminal Appeals overrules the Fifth Court of Appeals, this outlandish Texas spectacle may finally come to an end. Fittingly, Paxton has earned his reprieve through distinctly conservative principles: a strict appeal to the established rule of law, and fiscal restraint, which spurred the Lone Star State’s reliable voters to rein in the spendthrift special prosecutor.

Photo by Alex Wong/Getty Images