The CIA organised a fake vaccination programme in the town where it believed Osama bin Laden was hiding in an elaborate attempt to obtain DNA from the fugitive al-Qaida leader's family, a Guardian investigation has found.

As part of extensive preparations for the raid that killed Bin Laden in May, CIA agents recruited a senior Pakistani doctor to organise the vaccine drive in Abbottabad, even starting the "project" in a poorer part of town to make it look more authentic, according to Pakistani and US officials and local residents.

The doctor, Shakil Afridi, has since been arrested by the Inter-Services Intelligence agency (ISI) for co-operating with American intelligence agents.

Relations between Washington and Islamabad, already severely strained by the Bin Laden operation, have deteriorated considerably since then. The doctor's arrest has exacerbated these tensions. The US is understood to be concerned for the doctor's safety, and is thought to have intervened on his behalf.

The vaccination plan was conceived after American intelligence officers tracked an al-Qaida courier, known as Abu Ahmad al-Kuwaiti, to what turned out to be Bin Laden's Abbottabad compound last summer. The agency monitored the compound by satellite and surveillance from a local CIA safe house in Abbottabad, but wanted confirmation that Bin Laden was there before mounting a risky operation inside another country.

DNA from any of the Bin Laden children in the compound could be compared with a sample from his sister, who died in Boston in 2010, to provide evidence that the family was present.

So agents approached Afridi, the health official in charge of Khyber, part of the tribal area that runs along the Afghan border.

The doctor went to Abbottabad in March, saying he had procured funds to give free vaccinations for hepatitis B. Bypassing the management of the Abbottabad health services, he paid generous sums to low-ranking local government health workers, who took part in the operation without knowing about the connection to Bin Laden. Health visitors in the area were among the few people who had gained access to the Bin Laden compound in the past, administering polio drops to some of the children.

Afridi had posters for the vaccination programme put up around Abbottabad, featuring a vaccine made by Amson, a medicine manufacturer based on the outskirts of Islamabad.

In March health workers administered the vaccine in a poor neighbourhood on the edge of Abbottabad called Nawa Sher. The hepatitis B vaccine is usually given in three doses, the second a month after the first. But in April, instead of administering the second dose in Nawa Sher, the doctor returned to Abbottabad and moved the nurses on to Bilal Town, the suburb where Bin Laden lived.

It is not known exactly how the doctor hoped to get DNA from the vaccinations, although nurses could have been trained to withdraw some blood in the needle after administrating the drug.

"The whole thing was totally irregular," said one Pakistani official. "Bilal Town is a well-to-do area. Why would you choose that place to give free vaccines? And what is the official surgeon of Khyber doing working in Abbottabad?"

A nurse known as Bakhto, whose full name is Mukhtar Bibi, managed to gain entry to the Bin Laden compound to administer the vaccines. According to several sources, the doctor, who waited outside, told her to take in a handbag that was fitted with an electronic device. It is not clear what the device was, or whether she left it behind. It is also not known whether the CIA managed to obtain any Bin Laden DNA, although one source suggested the operation did not succeed.

Mukhtar Bibi, who was unaware of the real purpose of the vaccination campaign, would not comment on the programme.

Pakistani intelligence became aware of the doctor's activities during the investigation into the US raid in which Bin Laden was killed on the top floor of the Abbottabad house. Islamabad refused to comment officially on Afridi's arrest, but one senior official said: "Wouldn't any country detain people for working for a foreign spy service?"

The doctor is one of several people suspected of helping the CIA to have been arrested by the ISI, but he is thought to be the only one still in custody.

Pakistan is furious over being kept in the dark about the raid, and the US is angry that the Pakistani investigation appears more focused on finding out how the CIA was able to track down the al-Qaida leader than on how Bin Laden was able to live in Abbottabad for five years.

Over the weekend, relations were pummelled further when the US announced that it would cut $800m (£500m) worth of military aid as punishment for Pakistan's perceived lack of co-operation in the anti-terror fight. William Daley, the White House chief of staff, went on US television on Sunday to say: "Obviously, there's still a lot of pain that the political system in Pakistan is feeling by virtue of the raid that we did to get Osama bin Laden, something the president felt strongly about and we have no regrets over."

The CIA refused to comment on the vaccination plot.