Pakistan's military leader, President Pervez Musharraf, filed nomination papers on Thursday to run for re-election on October 6, while the Supreme Court prepared to rule on the army chief's eligibility to stand.
A bench of nine judges is due to deliver a ruling on Friday that could have far reaching consequences for Pakistan's transition to greater democracy, eight years after General Musharraf took power in a coup.
Pakistan faces months of uncertainty as Musharraf tries to keep control of a nuclear-armed country whose support for the United States is seen as crucial to the success of Western efforts to stabilize Afghanistan and battle al Qaeda.
If the court blocks Musharraf's re-election, analysts say he might impose emergency rule or dissolve parliament and seek a mandate as a civilian from assemblies after a general election.
Prime Minister Shaukat Aziz and ruling party leaders were upbeat as they delivered Musharraf's papers to the Election Commission, across an avenue from the Supreme Court.
"President Pervez Musharraf is the candidate of the Pakistan Muslim League (PML) and its allies, and we are fully confident that he will succeed," Aziz told reporters.
Security was tight in Islamabad, with riot police standing by and checkpoints on roads into the capital.
Police guarded the Supreme Court and its compound.
The court is hearing petitions challenging Musharraf's right to hold the posts of president and army chief, the legality of being elected in uniform, and whether he can get a mandate from outgoing assemblies before general elections due by mid-January.
"NOT PROPER, HONEST"
"This will not be a proper and honest transition to democracy," Aitzaz Ahsan, a prominent opposition lawyer, told the court before it adjourned for the day.
Chief Justice Iftikhar Chaudhry ordered authorities to release opposition activists detained in a weekend crackdown the government said was necessary to maintain order.
Musharraf's attempt to sack Chaudhry in March sparked a wave of protests, and his popularity has since slumped.
Pakistani shares ended 0.43 percent higher as investors took heart from Musharraf's nomination, dealers said. Investors were keen to see Musharraf continue policies that have produced strong growth and a booming stock market, they said.
An electoral college comprising members of the National Assembly, Senate and provincial assemblies will vote for a president before the assemblies are dissolved.
Musharraf has vowed to quit the army, his main source of power, after winning another term. He has held both posts under a 2004 constitutional amendment but his presidential term ends on November 15 and he is due to give up his army post by year's end.
Wajihuddin Ahmed, a former Supreme Court judge who refused to swear allegiance to Musharraf after his 1999 coup, filed his own presidential nomination. His lawyer supporters chanted "go Musharraf, go" as he entered the Election Commission.
"We are against him continuing as president of Pakistan in uniform or without uniform," Ahmed told reporters.
A senior member of the opposition Pakistan People's Party of former prime minister Benazir Bhutto, Makhdoom Amin Faheem, also registered to run. Musharraf and Bhutto have been discussing a power-sharing pact but have yet to reach agreement.
Several little-known candidates also filed papers. A final list will be published on Monday.
An alliance of opposition parties led by the party of another former prime minister, Nawaz Sharif, demands full democracy and an end to the army's involvement in politics, and has vowed to boycott the presidential election.
A boycott would not derail the vote -- Musharraf only needs a majority of votes cast and his PML holds a majority in parliament -- but it would detract from its credibility.
(Additional reporting by Zeeshan Haider and Augustine Anthony)