ISLAMABAD: Pakistan's envoy to the United States resigned Tuesday, losing a battle with the country's powerful generals to keep his job over allegations he wrote a memo to Washington asking for its help in reining them in.

Husain Haqqani told The Associated Press he stands by his denials, insisting he had nothing to do with the memo that was sent to then-US military chief Adm. Mike Mullen in May.

He said he was ''happy to face an inquiry'' into the affair. The affair underlined the tense relations bewtween the US and Pakistan, a key ally in its struggle against Islamic militants, and the internal struggle between civilian politicians and the military in Pakistan.

Haqqani is a key ally of President Asif Ali Zardari. He was generally well regarded in Washington, where he had a difficult job representing Pakistan during several crises, including the aftermath of the US raid that killed Osama bin Laden in May.

The memo accuses Pakistan army chief Gen. Ashfaq Pervez Kayani of plotting to bring down the government in the aftermath of the raid on Osama bin Laden on May 2. It asks Mullen for his ''direct intervention'' with Kayani to stop this.

In return, it promises a raft of policies long asked for by Washington and likely to enrage the army.

It says the government will allow the US to propose names of officials to investigate bin Laden's presence in Pakistan, facilitate American attempts to target militants like al-Qaida leader Ayman al-Zawahri and Taliban chief Mullah Omar and allow the US greater oversight of Pakistan's nuclear weapons.

The scandal, dubbed ''memogate,'' has highlighted the tensions between the weak government and the army, as well as the role that the United States plays in them.

Despite being under nominal civilian control, the army wields immense political and economic clout in the country. It has seized power in at least three coups and has helped dislodge other civilian governments.

Given that background, the affair has also led to pressure on the Zardari government, which some have speculated may have also known about the alleged memo.

Critics in the media, many viewed as proxies for the military establishment, have been calling for the president to be investigated, suggesting the memo could be treasonous.

A statement from the prime minister's office said an investigation into the affair would be conducted ''at an appropriate level'' and would be ''carried out fairly, objectively and without bias.''

Haqqani has long been viewed by critics as too close to America, regarded by many here as a hostile force, and to Zardari, who is also unpopular at home. Haqqani was a critic of the army's role in Pakistan but was also an eloquent defender of the country in Washington.

It was not immediately known who would replace him.