The Supreme Court in Pakistan has ordered the Election Commission to declare Gen Musharraf the winner of October's presidential election.
Musharraf has faced international fire over the state of emergency
Gen Musharraf won the vote easily after opposition boycotts and abstentions, but the previous judges in the court had questioned the poll's validity.
Many of those judges were sacked when Gen Musharraf imposed emergency rule.
Meanwhile, the former PM Nawaz Sharif is to once more return to Pakistan on Sunday, his brother has announced.
The new judges said Gen Musharraf must resign as army chief before being sworn in for his next term as president.
Gen Musharraf has come under intense international pressure to lift the state of emergency, which has seen thousands of opponents arrested and a clampdown on the media and independently-minded judges.
Sharif return plan
Earlier on Friday, the Supreme Court upheld Gen Musharraf's imposition of the emergency on 3 November.
The court has also dismissed all legal challenges to Gen Musharraf's eligibility in the October poll.
When Gen Musharraf imposed emergency rule he gave the need to rein in the judiciary as one of his justifications.
Judges and lawyers have been targeted by emergency rule
Now the new judges have told the Election Commission "to take all the necessary steps by 1 December, 2007 for final announcement" of the poll result.
And it said that Gen Musharraf, who seized power in a 1999 coup, "shall relinquish the office of the chief of army staff" before being sworn in.
The attorney-general has said he believes Gen Musharraf will resign as army chief this month.
Meanwhile, the former prime minister, Nawaz Sharif, is expected to renew his attempts to return from exile in Saudi Arabia.
Shabhaz Sharif said on TV his brother was meeting Saudi King Abdullah to say farewell and would be flying on Sunday to Lahore.
In September he was deported hours after landing in Islamabad.
Mr Sharif was deposed in 1999 in a bloodless coup by Gen Musharraf.
The main opposition leader, Benazir Bhutto, is still deciding whether or not to boycott parliamentary elections due in January.
Pakistan says a decision by Commonwealth on Thursday to suspend its membership from the body because of the imposition of emergency rule is "unreasonable and unjustified".
The Commonwealth had failed to appreciate Pakistan's "serious internal crisis", the foreign ministry said.
It added that it would review its ties with the group after the decision.
Commonwealth Secretary General Don McKinnon said Pakistan was being suspended "pending restoration of democracy and the rule of law".
Pakistan will now be banned from attending the organisation's meetings and taking part in the Commonwealth Games.
Pakistan has been engulfed in political upheaval in recent months, and the security forces have suffered a series of blows from pro-Taleban militants opposed to Gen Musharraf's support for the US-led "war on terror".