Pakistan's Supreme Court has begun hearing petitions contesting Pervez Musharraf's right to remain army chief if he seeks another term as president.
Gen Musharraf wants to be re-elected as president
Gen Musharraf says Pakistan's constitution lets him seek re-election while holding both oppositions.
He is facing growing political opposition, but the BBC correspondent in Islamabad says his greatest adversary may yet be the judiciary.
Gen Musharraf is seeking re-election by parliament before its term expires.
Our correspondent in Islamabad, Barbara Plett, says the Supreme Court has shown a new found independence in recent weeks.
Several rulings have gone against the government.
Now the court has been asked to decide whether the constitution permits the general to seek re-election while remaining head of the army.
He has enough votes in parliament to win another five-year term, but that would not help him if the court decides he is not an eligible candidate.
He had hoped to get around any obstacles by changing the constitution with the help of Pakistan People's Party of former Prime Minister Benazir Bhutto.
But so far the two sides have failed to reach agreement on a power-sharing deal.
The deadline for presidential elections is fast approaching, fuelling speculation about whether Gen Musharraf may take tough extra constitutional measures to stay in power.