The 6-2 decision by the Texas Court of Criminal Appeals, which is dominated by elected Republican judges, frees Perry from a long-running criminal case that blemished the exit of one of the most powerful Texas governors in history and hung over his second failed run for the White House.

A grand jury in liberal Austin had indicted Perry in 2014 for vetoing funding for a public corruption unit that Republicans have long accused of wielding a partisan ax. The unit worked under Travis County District Attorney Rosemary Lehmberg, an elected Democrat. Perry wanted her to resign after she was convicted of drunken driving.

Perry was accused of using his veto power to threaten a public official and overstepping his authority, but the judges ruled that courts can't undermine the veto power of a governor.

"Come at the king, you best not miss," Republican Judge David Newell wrote in his concurring opinion, quoting a popular line from the HBO series "The Wire."

Perry has been campaigning for Republican presidential candidate Ted Cruz since becoming the first major GOP candidate to drop out of the race last year. He conceded to reporters in Austin on Wednesday that the indictments hurt his candidacy but didn't dwell on the impact, and said he would veto the same funding again if given the chance.

"I've always known the actions I took were not only lawful and legal, they were right," said Perry, who spoke at the headquarters of an influential Texas conservative think tank, which has previously christened its balcony overlooking downtown as the "Gov. Rick Perry Liberty Balcony."

The court said veto power can't be restricted by the courts and the prosecution of a veto "violates separations of powers." A lower appeals court had dismissed the other charge, coercion by a public servant, in July.

Perry had rebuked the charges as a partisan attack from the start, calling it a "political witch hunt," but the dismissal brought accusations of Republican judges doing a favor for a party stalwart. Texans for Public Justice, a left-leaning watchdog group that filed the original criminal complaint that led to the indictment, said Perry was handed a "gift" based on his stature.

Even a Republican judge who dissented in the ruling said the decision could leave the public with an uneasy perception that the system went out of its way to clear a famous politician with deep connections.

"The constant references to 'Governor Perry' could well be seen by the public as an inference that appellant's position in life entitles him to special privileges and special treatment by this court that others might be denied," wrote Republican Judge Cheryl Johnson, referring to how judges addressed Perry during deliberations.

Perry, the longest-serving governor in Texas history, made just one court appearance in the case and was defiant from the start — he went out for ice cream after turning himself in for booking at an Austin jail, and smiled wide for his mug shot.

Legal scholars across the political spectrum raised objections about the case. Still, the Republican judge overseeing it repeatedly refused to throw it out on constitutional grounds, prompting Perry's appeals.

Michael McCrum, the special prosecutor who secured Perry's indictment, maintained that the matter was built on evidence — not politics — and deserved to go to trial. He can appeal, but that would be a lengthy process. Combined, the original charges carried a potential maximum of 109 years in prison.

Despite his legal problems, Perry had formally announced he was running for president in June, hoping to convince GOP primary voters he deserved another chance after his 2012 bid was undone by a series of public gaffes. But his second campaign lasted barely three months, and he dropped out of the race in September.

The former governor spent more than $2 million on top defense lawyers. His latest White House campaign raised barely half that much in its first month, and Perry blamed the indictment for his sluggish fundraising. But polls showed he was badly trailing despite visits to Iowa, New Hampshire and South Carolina. He was the first candidate to leave a GOP field jammed with 17 presidential hopefuls at the time.

___

Associated Press writers Will Weissert and Jim Vertuno in Austin contributed to this report.

WASHINGTON (AP) — America is waiting for special counsel Robert Mueller's report. But anyone looking for a grand narrative on President Donald Trump, Russian election interference and all the juicy details uncovered over the past 22 months could end up disappointed.

DUBUQUE, Iowa (AP) — At a packed eastern Iowa house party, a staffer for Democrat Beto O'Rourke's presidential campaign tried to clear enough space for the candidate to reach the kitchen, where he would need to climb a stepladder to address the crowd.

WASHINGTON (AP) — In a matter of months, Stacey Abrams has gone from losing the Georgia governor's race to being a heavily recruited Democratic star, urged to run for Senate and mentioned as a possible presidential contender.

LIMA, Ohio (AP) — President Donald Trump returned Wednesday to Ohio, the state that foretold his 2016 victory, with a tour of a tank plant, where he touted its revival and told cheering workers "we are rebuilding the American military, we are restoring American manufacturing and we are once again fighting for our great American workers.