Gov. Rick Perry of Texas is one of the least thoughtful and most damaging state leaders in America, having done great harm to immigrants, abortion clinics and people without health insurance during his 14 years in office. But bad political judgment is not necessarily a felony, and the indictment handed up against him on Friday — given the facts so far — appears to be the product of an overzealous prosecution.

For more than a year, Mr. Perry has been seeking the resignation of the Travis County district attorney, Rosemary Lehmberg. He had good reason to do so: Ms. Lehmberg was arrested in April 2013 for driving with a blood alcohol level of more than three times the legal limit, and she verbally abused the officers who found her with an open bottle of vodka. She ranted and raved at the local jail, threatening sheriff’s deputies, and she had to be restrained in a chair with a hood over her head. She pleaded guilty and was sentenced to 45 days in jail. In addition to endangering people’s lives, she instantly lost her credibility as a prosecutor of drunken-driving cases.

But Ms. Lehmberg is also an elected Democrat, and as the prosecutor in Austin, the state capital, she ran the Public Integrity Unit, which investigates corruption charges against state lawmakers, often including prominent Republicans. The office, in fact, has been investigating whether several medical research grants were improperly given to people with connections to Mr. Perry. Had she stepped down, the governor might have named a Republican to replace her, so she refused.

After the arrest, Mr. Perry told Ms. Lehmberg that if she didn’t resign, he would cut the financing for the Public Integrity Unit. In June, he did just that, using his line-item veto to zero out the $7.5 million for the unit. That was a bad idea. Had county officials not stepped in with some money, the veto could have shut down an important investigative body and its cases. Mr. Perry should have left the matter to the courts, where both a criminal and a civil attempt to have her removed failed, or to the voters.