Pakistan's chief justice ordered the immediate release of detained opposition members Thursday as President Gen. Pervez Musharraf formalized his disputed candidacy for a new five-year term.

Chief Justice Iftikhar Mohammed Chaudhry issued the edict after summoning police and government officials to explain who signed an order to close roads into the capital Thursday to prevent a planned lawyer-led protest against Musharraf.

Deputy Information Minister Tariq Azim said Chaudhry's decision "will be fully implemented."

About 200 people have been taken into custody nationwide since Saturday night, officials have said. Opposition parties claim the number is much higher.

The detentions have sparked sharp criticism, including from the U.S., Musharraf's biggest international ally. The government has defended the arrests as necessary to maintain law and order.

Ameer ul-Azeem, a spokesman for the opposition Muttahida Majlis-e-Amal (United Action Forum), called the order "good news" for the than 600 MMA leaders and workers that he said were arrested.

"The Supreme Court order gives us hope and a lash to the government, but still I am doubtful that all of our workers would be released," ul-Azeem said.

Musharraf has seen his popularity and power erode since his botched effort to fire the independent-minded Chaudhry earlier this year. Lawyers led mass protests for his reinstatement, claiming the general was illegally interfering in the judiciary.

Prime Minister Shaukat Aziz went to the Election Commission, along with some of the other 16 legislators who endorsed Musharraf's candidacy, to file the general's nomination papers. Another 42 candidates also submitted their candidacies.

Mushahid Hussain, secretary-general of Musharraf's ruling Pakistan Muslim League-Q party, was confident Musharraf would win the Oct. 6 vote by federal and provincial legislators despite critics who say he cannot run while remaining army chief.

"We have enough support for the victory," Hussain said.

Lawyers said Wednesday they would defy a ban on gatherings of more than five people in Islamabad. But a massive security presence meant only about 150 reached the Election Commission and the nearby Supreme Court as thousands of police guarded the area.

"Why are they scared of peaceful protest? This is our basic right," said Munir Malik, president of the Supreme Court Bar Association.

About 1,000 lawyers and supporters from opposition parties rallied in the eastern city of Lahore, vowing to continue their campaign for Musharraf's removal from office.

A group of lawyers filed nomination papers for retired Justice Wajihuddin Ahmed, who said he considered the country's best interests in deciding to run.

Makhdoom Amin Fahim, vice chairman of former Prime Minister Benazir Bhutto's Pakistan People's Party, also filed his nomination papers. The PPP said Tuesday he would only contest the election if Musharraf is barred.

Musharraf has held monthslong talks with Bhutto that could see them share power after parliamentary elections due by January.

Police blocked roads leading into Islamabad overnight with trucks and shipping containers, letting virtually no one through.

Sufie Mohammad, who said he needed to take his ailing father to a hospital, was among those turned back.

"I will be sorry if your father dies," a police officer told Mohammad. "But I have strict instructions that no one will be allowed to go into Islamabad today."

The Supreme Court, considering several legal challenges to Musharraf's candidacy, is expected to rule within days.

Aitzaz Ahsan, a lawyer called by the court to serve as an adviser, told the justices that the constitution barred military officers from seeking political office and that the Election Commission should reject his nomination to "once and for all close the door" to military intervention in politics.

But another court-appointed lawyer argued that Musharraf was qualified, urging the judges to keep in mind that the country is still making a transition from military rule.

"This court does not act or decide in a void. It has to take judicial notice of what is going on and the surrounding circumstances," said Abdul Hafeez Pirzada, a prominent constitutional expert.

Musharraf, who seized power in a 1999 coup, has pledged to step down as military chief and restore civilian rule if he gets a fresh mandate. But a government lawyer said Tuesday the general would remain army chief if he is not re-elected.

That has fueled opposition claims, denied by the government, that Musharraf will declare a state of emergency if the court blocks his candidacy.