(Reuters) - Pakistan's powerful military pledged Friday to continue supporting democracy, reiterating it was not planning a takeover as tensions grew over a controversial memo alleging an army plot to seize power.

At the same time, President Asif Ali Zardar's office said Zardari had no intention of leaving the country over the scandal, which has raised tensions and undermined the already deeply unpopular president.

An army statement quoted the military chief, Gen. Ashfaq Kayani, telling troops the military will continue to support democracy in Pakistan and that any talk the army was planning to take over was speculation.

Many Pakistanis wonder whether Zardari can survive the crisis, and speculation has been growing that the powerful generals will try to oust him somehow. The tension is a worrying sign for the region and for Pakistan's uneasy relationship with its key ally, the United States.

The United States wants political stability in Pakistan so that Islamabad can help fight militancy and aid Western efforts to stabilize Afghanistan.

Zardari, known for his resilience in the face of pressure, has no intention of leaving, a senior member of his ruling party said.

The current information is there is no such plan. He is very much here, the official, Shazia Marri, told Reuters.

It's all speculation, and such speculation has proven baseless in the past as well, Marri said.

Pakistan's top judge earlier moved to allay fears of a possible military coup as tensions rose.

There is no question of a takeover. Gone are the days when people used to get validation for unconstitutional steps from the courts, Supreme Court Chief Justice Iftikhar Chaudhry said.

The Supreme Court is looking into a petition demanding an inquiry into what has become known as memogate. Kayani, arguably the most powerful man in the country, has called for an investigation into who may have been behind the memo.

SPECTRE HAUNTS PAKISTAN

Newspaper editorials on Friday highlighted unease in the nuclear-armed South Asian nation, predicting a showdown between Zardari and his allies and the military, which is so influential it has been described as a state within a state.

A specter is haunting Pakistan -- the specter of a clash between the army and the government that threatens to turn fatal, said an editorial in the News.

Businessman Mansoor Ijaz, writing in a column in the Financial Times on Oct. 10, said a senior Pakistani diplomat had asked that a memo be delivered to the Pentagon with a plea for U.S. help to stave off a military coup in the days after the raid that killed Osama bin Laden in May.

Ijaz later identified the diplomat as Pakistan's ambassador to Washington, Husain Haqqani, a Zardari ally who denied involvement but resigned over the controversy.

The military faced unprecedented public criticism over the bin Laden affair, widely seen as a violation of sovereignty.

But many Pakistanis rallied around the army after a Nov. 26 air attack by U.S. forces in Afghanistan mistakenly killed 24 Pakistani soldiers on the border. The memo has also helped boost the army's image at the expense of the government.

Zardari's government has become increasingly unpopular since he took office in 2008. It has failed to tackle myriad problems, from crippling power cuts to suicide bombings and a struggling economy.

The army is fed up with Zardari and wants him out of office, although through legal means and without a repeat of the coups that are a hallmark of the country's 64 years of independence, military sources told Reuters on Thursday.

TEMPERS FLARE

Another military source said tensions must be defused.

Tempers are flaring, there is no doubt about that. However, there are efforts to pacify the situation as well. And I hope they work, as under the current scenario, it is fast becoming a recipe for a head-on collision, he told Reuters on Friday.

Dawn, one of the country's most respected newspapers, said it would be premature to assert that an extra-constitutional removal of the government was in the works, but it noted the army has seized power before.

Friction between Pakistan's civilian government and military have bedeviled the nation for almost its entire existence, with the military ruling for more than half its 64-year history.

The army remains the arbiter of power and analysts say it has plenty of ways to pressure Zardari to step down, especially if a link is established between him and the memo, which sought the Pentagon's help in averting a feared coup.

In the past the army has asked Pakistani civilian leaders to resign and influenced judicial proceedings against them.

On Thursday, Prime Minister Yusuf Raza Gilani told parliament that any institution acting as a state within a state was unacceptable, a clear reference to the military.

Zardari returned to Pakistan this week from medical treatment in Dubai that raised speculation he would resign under pressure from the military.

Although his position is largely ceremonial, he wields considerable influence as leader of the ruling party and his forced departure would be a humiliation for the civilian leadership and could throw the country into turmoil.

Zardari is the widower of former premier Benazir Bhutto, who spent years opposing military rule before she was assassinated in 2007.

Pakistan's next parliamentary elections are not due until 2013, although some opposition parties have been calling for early polls. Presidents are elected by legislators.

(Writing by Michael Georgy; Editing by Paul Tait)