Pakistan's top judge has ordered the immediate release of dozens of detained opposition supporters who have been taken into custody since the weekend.
President Musharraf faces opposition on the streets
Chief Justice Iftikhar Chaudhry made the ruling after summoning police and government officials to court.
He did so shortly after papers were filed naming Gen Musharraf to contest presidential elections on 6 October.
The Supreme Court is to decide whether he can stand for election while holding the posts of president and army chief.
Gen Musharraf will stand down as army chief if he is elected for another presidential term, but, if not, he will keep his military post, his lawyers have said.
Pakistan's president is not elected by the people, but by a ballot of federal and provincial assemblies.
The government has said it will abide by the Supreme Court order. It had argued that the detentions were necessary to maintain law and order.
Gen Musharraf says he will stay on as army chief if he is not re-elected
"All those taken into custody under preventive laws will be freed," said Deputy Information Minister Tariq Azim, the Associated Press news agency reports.
About 200 people have been taken into custody around Pakistan since late-night raids on Saturday, officials say.
Opposition parties say the number is much higher, and have expressed doubt that all their workers will be released.
Chief Justice Chaudhry - who was reinstated in August after Gen Musharraf tried to sack him - demanded to know who authorised the closure of roads into the capital to stop protests against Gen Musharraf.
Hours earlier, Prime Minister Shaukat Aziz and other senior figures from the government had filed President Musharraf's papers for the indirect vote on 6 October.
29 Sept: Date main opposition alliance to begin boycotting assemblies
Presidential vote to be held, election commission says
18 Oct: Date ex-PM Benazir Bhutto has set for her homecoming
15 Nov: Parliamentary term ends and general election must be held
Mr Aziz said he was confident the president would win the election. "This is a significant day for Pakistan," he said.
Officials say Gen Musharraf's forms carry his name without his army rank, quashing speculation that the president has described himself as Gen (Retired) Pervez Musharraf.
Retired judge Wajihuddin Ahmed has also filed his nomination for the presidential ballot. Analysts say he has little chance of beating Gen Musharraf.
The Pakistan People's Party (PPP) of Benazir Bhutto also nominated a candidate, Makhdoom Amin Fahim, who it says will run if the Supreme Courts bars Gen Musharraf from standing and the election still goes ahead.
Martial law fears
Thursday's developments follow months of political uncertainty in Pakistan, with vocal opposition to military rule.
The chief justice has been at loggerheads with the president
Earlier in the week, the US called on Gen Musharraf to ensure that forthcoming elections were free and fair, and described arrests of opposition activists as "troubling".
Attorney General Malik Mohammad Qayyum has denied the president has any plans to impose martial law if his re-election strategy does not go according to plan.
Correspondents say the big question now is what happens if he is not elected.
The BBC's Barbara Plett in Islamabad says the general is determined to prevent the opposition from taking to the streets to protest against his election bid.
Critics have said he is determined to cling to power, either as president or army chief, or both.