ISLAMABAD, Pakistan — A U.S. official being held in the fatal shooting of two Pakistani men told a court in the eastern city of Lahore on Friday that he had killed them in self-defense.

The official, based at the U.S. Consulate in Lahore, said the men had tried to rob him while he waited at a busy intersection in his car. A second consular vehicle that he summoned for help struck and killed a motorcyclist as it sped to the scene, police said.

A judge ordered the official held in custody for six days for further questioning.

Pakistani officials insisted Friday that the American, identified as Raymond Allen Davis, would receive no special treatment while possible charges of murder and illegal weapons possession are investigated.

“No one will be allowed to breach the law in Pakistan,” Interior Minister Rehman Malik told legislators. “The law will take its due course.”

But other Pakistani and U.S. officials, who would not discuss the sensitive matter on the record, said that Davis was clearly in the country on a diplomatic passport and visa and was immune from any prosecution. The U.S. government has demanded his release on that basis, officials said.

The incident has generated enormous media coverage in Pakistan and threatened to strain U.S. relations with the fervently anti-American country, a key ally and recipient of U.S. assistance. The deaths are being widely depicted as an illustration of Americans’ disregard for ordinary Pakistanis and as a test case of the unpopular central government’s capacity to stand up to its U.S. sponsors.

Davis arrived in Pakistan in September 2009 as a technical adviser to the consulate in Lahore, according to sources who said his job was to assist in vetting visa applicants. His initial three-month diplomatic visa, listing his birth year as 1974 and a home address in Las Vegas, has been repeatedly extended at U.S. request since then.

The CIA has declined to comment on whether he worked for the agency, although Pakistani officials said they do not believe he is an intelligence agent. Under special budget provisions, the State Department has given diplomatic status to hundreds of temporary employees hired in recent years, some of them through contractors, to bolster the ranks of rapidly expanding embassies in both Pakistan and Afghanistan.

Officials have declined to say why Davis had a gun, although it is not uncommon for Western diplomats – and Pakistanis – to carry firearms.

Rana Sanaullah, the law minister for Punjab province, said Davis told authorities he had withdrawn money from a bank shortly before the alleged holdup. Police said Thursday that they recovered two pistols from the dead men, but Sanaullah said he had doubts that Davis shot in self-defense.

A police official, who spoke on the condition of anonymity because he was not authorized to discuss the case, told The Washington Post on Friday that an autopsy showed both victims had been shot multiple times, including in the back.