Former Trump campaign chairman Paul Manafort is escorted into court for his arraignment in New York Supreme Court, June 27, 2019.

A judge on Wednesday dismissed New York state criminal charges filed against former Trump campaign chief Paul Manafort on double jeopardy grounds — thwarting an effort to ensure Manafort remains behind bars even if President Donald Trump ends up pardoning him for federal crimes that he was convicted of previously.

Manafort, 70, had faced charges of mortgage fraud, conspiracy and falsifying business records in the case, which was filed by Manhattan District Attorney Cyrus Vance Jr. immediately after the longtime Republican operative was sentenced earlier this year to 7½ years in prison on federal charges.

Manafort's lawyer, Todd Blanche, argued that the state charges were barred by double jeopardy — which prevents a defendant from being prosecuted twice for the same crime — because they related to mortgage applications that were the subject of Manafort's federal trial last year.

Manafort was convicted at that federal trial and in a subsequent guilty plea in another federal court last year of multiple crimes related to money he earned from consulting work for a pro-Russia political party in Ukraine, a role that predated his service in Trump's 2016 presidential campaign.

In a 26-page ruling issued in Manhattan Supreme Court on Wednesday, Judge Maxwell Wiley agreed with Blanche's argument, noting that Vance's office "conceded that the charges" against Manafort in the federal indictment against him "were based on the same acts and transactions that form the basis of all the charges in this New York State indictment."

"Given the rather unique set of facts pertaining to the defendant's previous prosecution in federal court, and given New York's law on this subject, defendant's motion to dismiss the indictment as barred by state double jeopardy must be granted," Wiley wrote.

Wednesday's dismissal was a major blow to Vance, whose case was seen as a way to thwart a possible attempt by Trump to let Manafort escape justice. Presidents can issue pardons only for federal crimes, not for state crimes.

Vance's spokesman said, "We will appeal today's decision and will continue working to ensure that Mr. Manafort is held accountable for the criminal conduct against the People of New York that is alleged in the indictment."

Blanche said, "We have said since the day this indictment was made public that it was politically motivated and violated New York's statutory double jeopardy law."

"We thank Judge Wiley for his careful consideration of our motion and his thoughtful opinion dismissing the charges against Mr. Manafort," Blanche said. "This indictment should never have been brought, and today's decision is a stark reminder that the law and justice should always prevail over politically-motivated actions."

Manafort was not in court when the state case was tossed out, having been hospitalized since last week after after experiencing a medical issue at the Pennsylvania prison where he is serving his federal sentence.

ABC News reported Tuesday that Manafort had suffered a "cardiac event."

Blanche said Tuesday that, "Neither his family nor I were made aware of his medical condition until after a reporter called with information they had learned about his condition, notwithstanding repeated attempts on our part to obtain information over the past several days from the Bureau of Prisons."