Updated

President Gen. Pervez Musharraf appointed a new intelligence chief and promoted five other generals in a staff shake up Friday just days after signaling he would quit the military if elected to a new five-year term.

Outside the Supreme Court, hundreds of flag-waving supporters of Pakistan's biggest Islamic party held an anti-Musharraf rally as judges heard petitions challenging his right to run for re-election.

Opposition parties, who claim it would be illegal for Musharraf to run, staged smaller street protests across Pakistan and their leaders vowed to quit parliament a week before the presidential vote.

The U.S.-allied Musharraf signaled Tuesday that he would step down as army chief if re-elected — restoring civilian rule eight years after he took power. Opposition parties, however, say that it would violate the constitution for him to run for re-election.

Musharraf's popularity has dropped since his botched effort to fire the chief justice of the Supreme Court earlier this year. His administration is also struggling to contain Islamic militancy amid unpopularity over Pakistan's alliance with Washington.

Underscoring the threat to his government, al-Qaida leader Osama bin Laden urged Pakistanis to rebel against Musharraf in a new message released Thursday, saying his military's siege of a militant mosque stronghold in July makes him an infidel.

In a preliminary shuffling of the army's top ranks announced by the military, Musharraf appointed Nadeem Taj, who was his military secretary in the 1999 coup, as director-general of the powerful Inter-Services Intelligence agency.

He replaces Ashfaq Kiani who is among the top generals tipped by analysts as a possible successor to Musharraf as army chief. The military did not say whether Kiani will be promoted or retire.

Even if Musharraf restores civilian rule, the top post in the army would remain a key position in Pakistan, which has alternated between weak civilian governments and military rule during its 60-year history. On Oct. 7, Musharraf's two top deputies in the army are due to retire.

In all, Musharraf promoted six top commanders to the rank of lieutenant general. Another possible successor, Tariq Majid, was replaced as the corps commander of Rawalpindi by Mohsin Kamal. The military also gave no details about Majid's future role.

About 1,000 flag-waving supporters of Pakistan's biggest religious party, Jamaat-e-Islami, rallied outside the white marble Supreme Court. Joined by supporters of exiled former Prime Minister Nawaz Sharif, they shouted, "Go, Musharraf, go!"

"We will not tolerate him in or out of uniform," lawmaker Hanif Abbasi told the protesters.

Inside the court, a nine-member panel of judges heard petitions before adjourning until Monday. A ruling that could determine Musharraf's eligibility for the election is expected early next week.

Scores of police with riot gear blocked the road in front of the court and surrounded the rally. After several hours, the protesters dispersed peacefully.

An electoral college comprising all federal and provincial lawmakers is to choose the next president on Oct. 6. Parliamentary elections are to follow by mid-January.

Raja Zafarul Haq, chairman of Sharif's party, said lawmakers from an opposition alliance would resign from the assemblies on Sept. 29 and protest nationwide the next day.

"Gen. Pervez Musharraf has no option. He is not eligible constitutionally, under the law and even morally to contest the election, but still he is trying to maneuver things in his favor," Haq said.

Under pressure from Washington to broaden the base of his government, Musharraf has held talks that could lead to him share power with former Prime Minister Benazir Bhutto, who plans to return to Pakistan Oct. 18 to campaign in the parliamentary elections.

While the negotiations have stalled, some analysts believe the two leaders will team up to oppose the conservatives supporters of Sharif and Islamist parties bitterly opposed to Musharraf's pro-U.S. policies.