A senior judicial official overturned the prison sentence of a Pakistani doctor who helped the CIA find Osama bin Laden and ordered his re-trial Thursday, citing procedural problems with the initial trial.

The official, Sahibzada Mohammad Anis, issued the ruling because the person who sentenced Dr. Shakil Afridi to 33 years in prison was not authorized to hear the case, said Feroz Shah, a government administrator.

Afridi was convicted in May 2012 of “conspiring against the state” by giving money and providing medical treatment to Islamic militants in Pakistan’s Khyber tribal area. The doctor’s family and the militants denied the allegations.

The case has caused friction between Pakistan and the United States, complicating a relationship that Washington views as vital for fighting the Taliban and al-Qaida, as well as negotiating an end to the war in neighboring Afghanistan.

In the U.S. and other Western nations, Afridi was viewed as a hero who had helped eliminate the world’s most wanted man. The doctor ran a vaccination program for the CIA to collect DNA in an attempt to verify the al-Qaida leader’s presence at the compound in the town of Abbottabad. U.S. commandos later killed bin Laden there in May 2011 in a unilateral raid.

Pakistani officials were outraged by the bin Laden operation, which led to international suspicion that they had been harboring al-Qaida’s founder. In their eyes, Afridi was a traitor who had collaborated with a foreign spy agency in an illegal operation on Pakistani soil, leaving many questions of whether Afridi was incarcerated as punishment for helping the CIA track down bin Laden.

Officials in Washington have called for Afridi to be released. On Thursday, State Department spokeswoman Marie Harf told journalists that Afridi’s continued detention “sends exactly the wrong message.”

“We hope this latest development leads to an outcome that reflects the fact that bringing Osama bin Laden to justice was clearly in Pakistan’s interest — as well as ours,” Harf said.

The doctor was tried under the Frontier Crimes Regulations, or FCR, the set of laws that govern Pakistan’s semiautonomous tribal region. Human rights organizations have criticized the FCR for not providing suspects the right to legal representation, to present material evidence, or to cross-examine witnesses. Verdicts are handled by a government official in consultation with a council of elders.

Anis, a commissioner tasked with enforcing the FCR, ruled that Afridi will be re-tried under the regulations by the top political official in Khyber, Shah said. Afridi was previously tried by the official’s assistant.

The doctor’s lawyer, Samiullah Khan, welcomed the decision to order a re-trial, saying: “I think it is a good achievement for us.” He called the original decision to sentence Afridi to 33 years in prison “totally illegal.”

But Khan said he was concerned about the decision to once again hold the trial under the FCR. He would rather the case be heard by a judge under Pakistan’s normal legal system.

Khan said he had not been able to share the news with his client. The doctor has been held in prison with little contact with the outside world, and the lawyer said it had been months since he’d seen his client.

It’s unclear whether a re-trial will result in Afridi being released or simply receiving a reduced sentence. Freeing the doctor would remove a sore point between Pakistan and the U.S. at a time when relations have warmed relative to the dark days following the bin Laden raid. But the operation still causes consternation in Pakistan, and it could be politically difficult for the government if Afridi is released.