Image caption Mr Haqqani has been ambassador to the US since 2008

Pakistan's ambassador to the United States has resigned over claims that he sought Washington's help against his country's military.

Husain Haqqani is accused of compiling a memo seeking US help to avert a military takeover in Pakistan following the killing of Osama Bin Laden in May.

The ambassador denied the allegations, which were made by a US-based lobbyist.

The row has put already tense relations between Pakistan's civilian and military leaders under severe strain.

Mr Haqqani was summoned to Islamabad earlier this week and offered to resign after meeting Pakistan's top civilian leaders, the head of the army and intelligence service chiefs on Tuesday.

State television said that his resignation had been accepted. The prime minister's office said Mr Haqqani had been asked to resign.

"I have much to contribute to building a new Pakistan free of bigotry and intolerance," Mr Haqqani said in a Twitter message. "Will focus energies on that."

Imran Khan question

Analysis It was difficult to see how Husain Haqqani could survive the huge scandal that's become known here in Pakistan as "memogate". For many Pakistanis, his alleged actions amounted to nothing less than treason and so there has been a clamour, particularly from opposition groups, for Mr Haqqani to go, and to be tried for his behaviour. If it is accepted that the memo, which has now been made public, is genuine, the question is did the ambassador act alone, or was it really the Pakistani president asking for help from the US? If that is proved, Asif Ali Zardari's position, too, could be in jeopardy. In any case, already strained relations between the Pakistani government and the army have taken a disastrous turn.

A prime ministerial spokesman said that all concerned in the affair would be given a "sufficient and fair opportunity" to present their views before an investigation which would be "carried out fairly, objectively and without bias".

Mr Haqqani, a close ally of President Asif Ali Zardari, has repeatedly denied any role in drafting or delivering the memo.

However, former US Joint Chiefs Chairman Michael Mullen confirmed receiving a secret communication. But he said he did not pay any attention to it and took no follow-up action.

The row over "memogate" originates from a Financial Times article by Pakistani-American businessman Mansoor Ijaz, published on 10 October.

In it, Mr Ijaz said that President Zardari had offered to replace his country's military leadership and cut all ties with militant groups following the killing of Bin Laden last May.

It is far from clear that President Zardari could deliver on either score.

BBC Monitoring's Sajid Iqbal says the saga took a new twist over the weekend when Mr Ijaz absolved Mr Zardari of any blame and singled out Husain Haqqani for the contents of the memo.

"The memo's content in its entirety originated from him," Mr Ijaz told a news agency.

The affair has led to the Pakistani media raising new questions about the role of the military - and the US - in Pakistani politics.

It has been complicated by the involvement of opposition politician and former cricketer Imran Khan.

He named Husain Haqqani as a player in the "memogate" affair at a large rally in Lahore on 30 October - before Mr Ijaz had brought his name into the public domain in the West.

Mr Khan has yet to explain why he did so.

Militant link

It has also emerged that Pakistani spy chief Shuja Pasha flew to London to meet Mr Ijaz on 22 October, less than two weeks after he revealed the existence of the memo in the Financial Times.

Image caption Imran Khan's comments have been questioned

The article said that a new security team would be set up within Pakistani intelligence to replace the unit charged with maintaining relations with the Taliban.

"This will dramatically improve relations with Afghanistan," Mr Ijaz wrote in the article, quoting widely from the memo which he said had been delivered to Adm Mullen on 10 May.

How he came by his information is also not clear.

Correspondents say the machinations described by Mr Ijaz paint a picture of a Zardari government scrambling to save itself from an impending military coup following the raid on Bin Laden's compound - and asking for US support to prevent such a coup before it started.

Mr Haqqani has been accused by the Pakistani press and some politicians of playing a role in the drafting of the memo because he has long acted as a link between the civilian government in Pakistan and the Obama administration.

But he denies any wrong-doing.

"At no point was I asked by you or anyone in the Pakistani government to draft a memo and at no point did I draft or deliver such a memo," Mr Haqqani was quoted by the US-based Foreign Policy magazine as saying in a letter offering his resignation to President Zardari.