The American who fatally shot two men in Pakistan last month and who has been described publicly as a diplomat is a security contractor for the CIA who was part of a secret agency team operating out of a safe house in Lahore, U.S. officials said.

The contractor, Raymond A. Davis, 36, has been detained in a Pakistani jail since his arrest. He has said that he opened fire on two Pakistani men after they tried to rob him at a traffic signal in Lahore.

The disclosure compounds an already combustible standoff between the United States and Pakistan at a time of growing distrust between the two countries and complicates U.S. efforts to win Davis's release.

President Obama and other senior administration officials have repeatedly described Davis as a diplomat who was assigned to the U.S. Consulate General in Lahore and have said he is entitled to immunity from prosecution in Pakistan.

But, in fact, Davis has spent much of the past two years working as part of a group of covert CIA operatives, whose mission appears to have centered on conducting surveillance of militant groups in large cities, including Lahore.

At the time of his arrest, Davis was based at a house with five other CIA contractors as well as an agency employee, a U.S. official said, speaking on the condition of anonymity because of the sensitivity of the matter.

The official said the impact of the disclosure that Davis is a CIA contractor "will be serious.

"I think it's going to make it a hell of a lot harder to get him out," the official said. "I think ISI knows what this guy is, but I think this is just going to inflame the Pakistanis."

ISI is the acronym for Pakistan's spy service, the Inter-Services Intelligence directorate.

"Our security personnel around the world act in a support role providing security for American officials. They do not conduct foreign intelligence collection or covert operations. Any assertion to the contrary is flat wrong," said George Little, a spokesman for the CIA, without commenting specifically on Davis.

The Washington Post learned of Davis's CIA affiliation after his arrest but agreed not to publish the information at the request of senior U.S. intelligence officials, who cited concern for Davis's safety if his true employment status were disclosed.

Those officials withdrew the request Monday after other news organizations identified Davis as a CIA employee and after U.S. officials made a final attempt to prevail upon Pakistan's government to release Davis or move him to a safer facility.