LAHORE, Pakistan - A Pakistani court ordered the government Tuesday not to release an American official arrested in the shooting deaths of two Pakistanis despite U.S. insistence that he has diplomatic immunity and has been detained illegally.

Lahore High Court Chief Justice Ijaz Chaudhry also told the government to place the American on the "exit control list" so that he cannot leave the country. Some legal experts questioned whether the court had the authority to issue such orders, but the rulings could further complicate what has become a serious diplomatic spat between the two countries.

The U.S. Embassy in Islamabad has argued that the American, who it has not named, acted in self-defense when he shot the two men in Lahore last Thursday because they were trying to rob him at gunpoint. It has issued several statements insisting he has diplomatic immunity and demanding he be released.

A copy of the American's passport obtained by The Associated Press identifies him as 36-year-old Raymond Allen Davis.

Pakistani officials have seemingly gone out of their way to avoid taking responsibility for deciding whether Davis should be released, likely because of possible backlash in a country where anti-American sentiment is rife despite billions of dollars in U.S. aid.

When asked whether the American has diplomatic immunity, federal government officials, including the president and the prime minister, have said they must wait until provincial legal officials finish their review -- or have pointed their fingers at other federal ministries that must decide.

Local officials in Punjab province, where Lahore is the capital, have said it is up to the federal government, not provincial authorities, to decide whether Davis has diplomatic immunity. If not, provincial prosecutors have said they will pursue murder charges.

The national and provincial governments are controlled by rival political parties, and Davis' case could be caught up in this competition.

Chaudhry, the chief justice, demanded that the federal government determine whether the American has diplomatic immunity within 15 days and said he would review the final decision himself.

But Azhar Sadique, a senior constitutional lawyer, said the court was overreaching — behavior for which it has been criticized in the past.

"As far as the issue of diplomatic immunity is concerned, this issue must be decided by the two (national) governments or by the international court of justice," said Sadique.

He also said that only a trial court or the government could prevent a person from leaving the country.

Despite the questionable jurisdiction, Punjab's deputy attorney general, Naveed Malik, said before the ruling that the provincial government would accept any decision by the Lahore High Court about Davis.

The court issued its rulings after hearing a petition from a local lawyer who feared Pakistan would release the American as a result of U.S. pressure.

A third man died when he was allegedly hit by an American car that rushed to the scene to help Davis. Pakistani police have said they want to question the driver of that vehicle as well.

Many Pakistanis already regard the U.S. with suspicion or enmity because of its occupation of neighboring Afghanistan and regular missile attacks against militant targets in Pakistan's northwest. Islamist and rightwing opponents of Washington and the U.S.-allied government here have said the recent shooting was a further example of American brutality.

The U.S. has said Davis was a member of the embassy's technical and administrative staff but has not clearly identified his job or explained why he was carrying a gun. The lack of clarity has fueled media speculation that he may be a CIA agent or security contractor and raised questions about whether he qualified for diplomatic immunity.

Washington has made strengthening ties with Pakistan a top priority and is committed to giving it $7.5 billion dollars in civilian aid, one of its largest programs anywhere in the world. It wants to secure the country's help in stabilizing Afghanistan by attacking militant sanctuaries on its side of the border.

But the relationship between the two countries has often been strained by Pakistan's reluctance to carry out operations against key Afghan militants demanded by the U.S.

Meanwhile, a government prosecutor assigned to assist the court said he has resigned in protest after his department withdrew him from the case.

Rana Bakhtiar Ahmad had given public statements arguing that the U.S. official did not enjoy diplomatic immunity. "I have resigned though I was not under pressure to do so," he said.