Pakistan's premier on Wednesday appeared to back down from a confrontation with the military, moving away from remarks made this month that it had acted unconstitutionally in supporting a court investigation of a controversial memo.

I want to dispel the impression that the military leadership acted unconstitutionally or violated rules, said Prime Minister Yusuf Raza Gilani, according to state television.

The current situation cannot afford conflict among the institutions.

His comments appeared to be a bid to defuse the worst tensions between civilian leaders and the powerful military since a 1999 army-led coup and came a day after a high-level meeting with the top army brass to discuss a possible trilateral summit on the future of Afghanistan.

Gilani had criticized the army chief General Ashfaq Kayani and director general of the military's Inter-Services Intelligence agency Lieutenant-General Ahmed Shuja Pasha in January for filing responses in a Supreme Court investigation into the origins of mysterious memo that has pitted the military against the civilian government.

In an interview with Chinese media, Gilani had said the filings were unconstitutional, infuriating the military's high command which responded with a stern press release, warning of very serious ramifications with potentially grievous consequences for the country.

But the standoff that had sparked talk of a coup in the nuclear-armed nation grappling with the fallout from the U.S.-led war in neighbouring Afghanistan and a weak economy appears to have ended, for now, an analyst said.

This was designed to defuse the situation, and adopt a conciliatory position towards the military, to pacify them, said Hasan Askari Rizvi, a political analyst.

Both the military and the government have realized that fighting will not serve anyone's purpose. Perhaps good sense has prevailed.

Despite being officially under civilian control, the military sets foreign and security policies. It attracted rare public criticism after U.S. special forces killed al Qaeda leader Osama bin Laden on Pakistani soil in a raid in May 2011, an act seen by many Pakistanis as a violation of sovereignty.

The United States wants smooth ties between civilian and military leaders so that Pakistan can help efforts to stabilise neighbouring Afghanistan, a top priority for President Barack Obama.

The military, which has ousted three civilian governments in coups since independence in 1947, has ruled Pakistan for more than half of its history.

(Writing by Chris Allbritton; Editing by Ed Lane)