For some Americans the Pakistani doctor who worked on a clandestine operation to track down one of the US's greatest enemies is a hero who should be given citizenship. But for Pakistan's security agencies Dr Shakil Afridi, a 48-year-old physician who once led campaigns to vaccinate children against polio on the Afghan frontier, is a villain.

On Wednesday a representative of the country's main spy agency said Afridi had got what he deserved when he was sentenced to 33 years in prison for conspiring against the state, for his role in trying to help the CIA track Osama bin Laden to his hideout in the garrison town of Abbottabad.

The verdict, passed under colonial-era legislation that denies defendants the right to a lawyer, was handed down by an official from Khyber Agency, one of Pakistan's semi-autonomous tribal areas, in consultation with a council of elders. Afridi was also fined £2,221.

The former public health officer, who reportedly did not know who exactly the CIA were trying to target, was arrested soon after the night-time raid on the former al-Qaida leader's compound on 2 May last year.

As first revealed by The Guardian, in the weeks running up to the assault by US Navy Seals Afridi had been running a bogus hepatitis B vaccination campaign for the CIA, a front designed to collect blood samples in the hope of finding people who matched the bin Laden family DNA.

More than a year after the killing of bin Laden he is the only person to have been arrested in connection with an event which humiliated Pakistan's all-powerful military establishment and severely undermined relations between the US and Pakistan.

An official inquiry into all aspects of the affair appears more vexed by how US forces could have got in and out of Pakistan without being detected than whether Bin Laden had a network of helpers who are still at large.

The conviction of Afridi came despite public lobbying by senior Americans, including the US defence secretary, Leon Panetta, who in January publicly said Afridi had "helped provide intelligence that was very helpful with regard to this operation".

The support of Dana Rohrabacher, a controversial US Congressman who introduced legislation calling for Afridi to be given US citizenship, was perhaps less helpful. Rohrabacher is reviled by the Pakistani establishment for his support for a nationalist movement in the southern province of Baluchistan.

"He was not in any way treasonous towards Pakistan," Panetta said in January. "He was not in any way doing anything that would have undermined Pakistan."

But that did not wash with a Pakistani intelligence official who compared Afridi to Jonathan Pollard, a former US intelligence analyst who was imprisoned for spying on behalf of Israel.

"He was working for a spy agency of a third country, irrespective of the fact that country is an ally," said the official.

On Wednesday Pentagon press secretary George Little responded to questioning about the verdict, saying: "Anyone who supported the United States in finding Osama bin Laden was not working against Pakistan. They were working against al-Qaida."

Lawyers were puzzled by the decision to try Afridi under the Frontier Crimes Regulation (FCR), a much criticised set of harsh rules designed by the British in the 19th century to subjugate unruly tribes.

Wajihuddin Ahmed, a former supreme court judge, said the FCR did not cover Abbottabad where the writ of regular Pakistani law runs. The authorities may have wished to deal with the case in a "hush hush type of hearing".

"Everyone is entitled to be tried in an ordinary court and in ordinary way and I cannot understand why they would do that if the offence – if it is an offence at all – was committed in Abbottabad," he said.

Although Afridi has the right to appeal against the verdict to an official known as the FCR Commissioner, his best hope may lie in a presidential pardon, should relations between Pakistan and the US improve. That is not likely in the near term given the fundamental disagreements between the two countries over American use of drone attacks in the tribal areas and Washington's refusal to formally apologise for the killing of 24 Pakistani soldiers in an incident on the Afghan border last September.

The announcement of Afridi's sentence came days after Barack Obama snubbed Asif Ali Zardari by refusing to hold a formal bilateral meeting with the Pakistani president at the Nato conference in Chicago.

The Americans are furious that Zardari's government has refused to lift a six-month long ban on Nato supply trucks passing through Pakistani territory.

US and Pakistani officials give different accounts of the importance of Afridi's work in determining bin Laden's whereabouts. The US has long maintained that policymakers were far from being completely sure the terrorist leader was in the house when the raid was launched.

However, Pakistani officials recently told The Guardian that although the nurses working for Afridi were not allowed to vaccinate anyone they did succeed in getting a mobile phone number for someone inside the bin Laden compound.

The Pakistani sources say that phone call allowed the CIA to make a voice match to bin Laden's private courier, a man known as Abu Ahmed al-Kuwaiti.

All of the 17 health workers who assisted Afridi on the vaccination drive were sacked in March after being officially criticised for acting "against the national interest".

Aid under threat

Pakistan's aid community is still reeling from Dr Shakil Afridi's clandestine activities to pinpoint the whereabouts of Osama bin Laden.

In a country in which well-meaning health workers can struggle to reach conservative or conflict-torn areas where outsiders are unwelcome, Afridi's work with the CIA has undermined their efforts.

With his band of 17 health workers, Afridi pretended to be running a hepatitis B vaccination campaign. In fact they were only interested in collecting DNA that might link people in Abbottabad with Bin Laden.

There are fears that the exposure of the ruse has helped to link public health campaigns with foreign spies.

That is all the more unfortunate given Afridi's prior history working on polio vaccination campaigns in Pakistan's restless tribal areas.

Pakistan is one of just three countries that have failed to eradicate the disease that leaves children with withered legs. Despite polio eradication being a government priority, as many as 200,000 children were not vaccinated in the past two years.

Save the Children has been particularly badly affected by the saga. Afridi reportedly told investigators from Pakistan's military intelligence agency that he was originally introduced to the CIA by the aid organisation – a claim Save the Children denies.

The organisation has since faced a number of problems, including staff being refused visas and the blocking of vital medical supplies from coming into the country.

The aid community is so disconcerted by the affair that in March a coalition of 200 organisations wrote to David Petraeus, director of the CIA, protesting about the use of a doctor to track down bin Laden.