PHOENIX (AP) — An appeals court has denied former Phoenix-area Sheriff Joe Arpaio’s bid to erase his criminal conviction for disobeying a 2011 court order, saying President Donald Trump’s pardon makes it unnecessary.

Arpaio was convicted for disobeying an order barring his traffic patrols that targeted immigrants.

Arpaio, who was defeated for reelection in 2016 after six terms, had argued the misdemeanor contempt of court conviction should be removed from his record so it can’t be raised against him in future court cases. The 87-year-old lawman, who is running for sheriff again this year, called the decision a victory.

A 2017 lower court decision also said Trump’s pardon removed his possible punishments and that pardons don’t erase convictions or the facts of cases.

The 9th Circuit Court of Appeals on Thursday rejected Arpaio’s request, saying the verdict no longer has any legal consequence because of the pardon. The judges explained Arpaio was pardoned before he could be sentenced and that the final judgment in the case ended up dismissing the contempt charge.

WATCH: What the Arpaio pardon reveals about Trump’s take on the rule of law

Despite the ruling, Arpaio and his attorney portrayed the decision as a victory because the ruling found the guilty verdict has no legal consequences. “They can’t use that conviction against me in a court of law,” Arpaio said. “That’s a win.”

Jack Wilenchik, one of Arpaio’s attorneys, said the appeals court gave them what they were asking for.

“The 9th Circuit expressly found that the guilty finding has no future preclusive effect, which is what Arpaio actually sought,” Wilenchik said. “This has exactly the same effect as an order ‘vacating’ the verdict.”

Special prosecutor Christopher Caldwell had previously said there were no legal consequences to the verdict.

The U.S. Department of Justice, which had won the conviction, later sided with Arpaio after the pardon was issued and argued the conviction should be expunged.

Arpaio was accused of prolonging his immigration patrols for 17 months to boost his 2012 re-election. He has acknowledged continuing the patrols but insisted his disobedience wasn’t intentional.