ISLAMABAD — The Pakistani doctor who helped the CIA hunt for Osama bin Laden was sentenced Wednesday to 33 years in prison for treason in an administrative action under colonial-era laws that avoided a public trial.

The move brought condemnation in Washington, where officials had been hoping to win freedom for Shakil Afridi, whom Pakistani intelligence agents detained three weeks after the May 2, 2011, U.S. special forces raid in the town of Abbottabad that ended in bin Laden’s death.

Sens. John McCain, R-Ariz., and Joe Lieberman, an independent from Connecticut, called the verdict “shocking and outrageous” in a statement.

“What Dr. Afridi did is the furthest thing from treason. It was a courageous, heroic and patriotic act, which helped to locate the most wanted terrorist in the world, a mass murderer who had the blood of many innocent Pakistanis on his hands,” the statement said. “Dr. Afridi set an example that we wish others in Pakistan had followed long ago. He should be praised and rewarded for his actions, not punished.”

Afridi had set up a fake health program in Abbottabad, sending health workers door to door to vaccinate residents for hepatitis B, in an effort to get DNA samples from the house where the CIA suspected that bin Laden lived.

U.S. officials were never sure that bin Laden was in the home, to which they had traced an al-Qaida courier. Afridi’s work, carried out in he weeks leading up to the raid, was an important part of the CIA’s attempts to verify that bin Laden was in the house.