Editor's note: This story has been updated throughout.

The state’s highest criminal court has dismissed the remaining indictment against former Gov. Rick Perry related to a 2013 veto threat, likely bringing an end to a legal saga that loomed over his final days in office and dogged his failed run for president.  

The Texas Court of Criminal Appeals on Wednesday ruled that courts could not limit veto power and that prosecuting Perry over his action violates “the separation of powers provision of the Texas Constitution” and infringed on his First Amendment right to freedom of speech. Two of the court’s nine judges dissented, and one abstained.

The ruling signals an end to more than 18 months of criminal proceedings that stretched into a presidential campaign that never gained traction. 

The Texas Tribune thanks its sponsors. Become one.

"The court upheld the rule of law and the fundamental right of any person to speak freely without fear of political interference or legal intimidation," Perry said Wednesday at a brief press conference in Austin. “The actions that I took were not only lawful and legal, but they were right.”

The case against the longest-serving governor in Texas history centered on a threat to veto $7.5 million in state funds for the public integrity unit of the Travis County district attorney's office, and questions about whether he abused his authority — allegations that he called a "baseless political attack." The unit was charged with investigating and prosecuting state corruption.

After Travis County District Attorney Rosemary Lehmberg was arrested and pleaded guilty to driving while intoxicated, Perry threatened to veto state funding for the integrity unit unless she first resigned.

Lehmberg remains in office but is not seeking re-election.

At issue in the case the Court of Criminal Appeals considered: a 2015 ruling by a state appeals court that dismissed the coercion charge. Perry's lawyers challenged that decision, arguing that the Austin-based 3rd Court of Appeals should have also dismissed the abuse-of-power charge. The state also got involved, appealing the ruling because it struck down a part of the Texas penal code that defines coercion.

Perry and his lawyers argued — successfully, as it turns out — that he was acting within the powers of a governor and did nothing criminal.

The Texas Tribune thanks its sponsors. Become one.

No one disputed that Perry had veto authority. The allegation was that he improperly combined the two — that he illegally tied his power to eliminate state funding for the integrity unit to his demand that Lehmberg resign, effectively setting up a quid pro quo arrangement that crossed the line into an abuse of power.

In Wednesday’s ruling, the court concluded that the Texas Constitution neither imposes “any restriction on veto based on the reason for the veto,” nor does it “allow any other substantive limitations to be placed on the use of a veto.”

Meanwhile, “no law passed by the Legislature can constitutionally make the mere act of vetoing legislation a crime,” the majority wrote. As a result, the indictment against Perry violated the constitution’s separation of powers, the opinion said.

Judge David Newell set up his concurring opinion by quoting Omar Little, an infamous fictional Baltimore stickup man in the HBO series The Wire: “Come at the king, you best not miss.” Newell wrote that everyone involved made the case more complicated “because of who it involves.”

The two dissenting judges also suggested that the case’s arc was greatly impacted by who the defendant was. 

“It seems clear to me that it has decided to employ any means necessary in order to vacate the two felony counts against Governor Rick Perry,” Judge Lawrence Meyers wrote. “The majority opinion has repealed more statutes and made more new law than Governor Perry did in the last session of the legislature when he tried to muscle out the elected Travis County District Attorney.” 

Michael McCrum, the special prosecutor in the case, called the ruling “horrendous.”

“This is a situation where the Republican court carved out a special ruling to get Perry off the hook. It changes law for past decades and offers no laws for future courts to follow,” he said. “This is, from what I understand, a special ruling tailor-made for Rick Perry.”

The Texas Tribune thanks its sponsors. Become one.

Craig McDonald, executive director of Texans for Public Justice, the liberal-leaning watchdog group behind a complaint that led to the indictment, largely echoed that notion.  

"A highly partisan court has handed Rick Perry a gift,” he said. “This decision is based on who Perry is rather than what he did.” 

But Tony Buzbee, Perry’s attorney, called the case “foolishness” that should have never been brought in the first place.

Perry told reporters Wednesday that he would veto the funding again if given a second chance. Still, he suggested that the legal questions might have helped torpedo his presidential bid.

“Obviously this indictment — as it would anybody — had a negative effect on our candidacy,” he said at the press conference.

Perry had worked hard to convince GOP primary voters he was more prepared for a 2016 run than he was during his 2012 campaign, which flamed out in a series of gaffes. But his latest bid for the White House failed to gain traction, especially during a summer in which attention-grabbing businessman Donald Trump shot to the top of polls — trailed by another Texan, U.S. Sen. Ted Cruz.

In the immediate aftermath of his indictments, Perry touted his efforts to oust Lehmberg from office, and his supporters sold T-shirts with her unflattering mug shot. But when he suspended his presidential bid in September, he blamed the legal issues, saying they harmed his fundraising efforts.

Perry declined to answer a question Wednesday about whether his fierce attacks against Trump also harmed his bid. 

“If we want to take the rest of the afternoon and talk about how things change on a political campaign, we can do that,” he said. “I don’t think that’s particularly of great utility here today.” 

Former Gov. Rick Perry visits Sandy's Hamburgers in Austin after the state's highest criminal court rules that his remaining felony indictment should be dismissed.
Former Gov. Rick Perry visits Sandy's Hamburgers in Austin after the state's highest criminal court rules that his remaining felony indictment should be dismissed.

Perry followed up the press conference with a sugary blast from the past, posting on Instagram a photo of himself enjoying an ice cream cone with his aides at Sandy’s Hamburgers, the popular Austin joint that the Republican famously visited after he was booked at the Travis County jail in August 2014.

“Epic legal victory falls on the 180th anniversary of Col. Travis's Victory or Death letter: 'I shall never surrender or retreat,'” he wrote Wednesday on his Instagram account

Terri Langford contributed to this report.

Disclosure: Tony Buzbee was a major donor to The Texas Tribune in 2012. A complete list of Tribune donors and sponsors can be viewed here.