HOW COULD Pakistan sentence someone to 33 years in prison for helping track down Osama bin Laden?

Bending over backward to be fair, you might reply: Well, no country likes its citizens cooperating with the secret service of another nation. As Pakistani Ambassador Sherry Rehman told us, “Pakistan assisted more than anyone else, but this is an issue about the law, and we can’t have people contracting with foreign agencies.” Jonathan Pollard, an American, is serving a life sentence for spying for Israel, a U.S. ally.

The differences outweigh the similarities, however. Mr. Pollard sold highly classified secrets. Shakil Afridi, 48, had access to no secrets. The United States enlisted him to help track down a mass murderer whom Pakistan was bound, under U.N. resolutions, to do everything in its power to apprehend. Americans wonder why Dr. Afridi is not being treated as a hero — and why no one in Pakistan has been punished for knowingly or unknowingly allowing Osama bin Laden to live peaceably in a military garrison town for so long.

Much about the doctor’s case remains unknown to the public. He reportedly ran a fake vaccination campaign to obtain blood samples from people in the bin Laden compound so that the CIA could verify their identity. Apparently he did not manage to obtain samples, but whether he was helpful in any way is not clear. Whether he knew for whom he was working, or in what cause, is also unknown. How the Pakistani government learned his identity, whether the CIA offered to evacuate him in the days following the bin Laden killing — also shrouded in mystery.

What is known is that Pakistani agents arrested him May 22, 2011, three weeks after the raid, and that a tribal court sentenced him Wednesday to 33 years in prison for treason after a secret trial in which he did not have the right to present evidence or be represented by an attorney.

The government surgeon is a victim of U.S.- Pakistani tensions. Pakistanis are affronted that U.S. forces entered their territory to hunt down Osama bin Laden without informing them. Americans are astonished that Pakistanis are more affronted by that infringement of sovereignty than they are embarrassed or disgusted that the bin Laden clan lived so easily in their nation for the better part of a decade.

The Afridi case does not change the U.S. interest in Pakistan, which lies in continued, frustrating but essential efforts to bolster civilian institutions and target terrorist safe havens.

But the United States has a responsibility to do everything within its power to see Dr. Afridi freed. The Senate Armed Services Committee was right to vote to make some aid conditional on that outcome. As ranking member John McCain (R-Ariz.) and committee chair Carl Levin (D-Mich.) said, “Dr. Afridi set an example that we wish others in Pakistan had followed long ago. ”

Dr. Afridi has the right to appeal his conviction, Ms. Rehman said. Secretary of State Hillary Rodham Clinton said that the United States will press Pakistan to release the doctor. That should be a priority.