WASHINGTON — In the months before Osama bin Laden was killed, the Central Intelligence Agency ran a phony vaccination program in Abbottabad, Pakistan, as a ruse to obtain DNA evidence from members of Bin Laden’s family thought to be holed up in an expansive compound there, according to an American official.

The vaccination program was set up as the C.I.A. was struggling to learn whether Bin Laden was hiding in the compound, and adds a new twist to the months of spy games that preceded the nighttime raid in early May that killed the Qaeda chief.

It has also aggravated already strained tensions between the United States and Pakistan. The operation was run by a Pakistan doctor, Shakil Afridi, whom Pakistani spies have since arrested for his suspected collaboration with the Americans. Dr. Afridi remains in Pakistani custody, the American official said.

Getting DNA evidence from the people hiding in the Abbottabad compound would have been a significant coup, because it would have allowed the C.I.A. to match the samples with DNA from other members of the Bin Laden family that are on file at the C.I.A. — providing the first hard evidence in years of his whereabouts.