Musharraf's hasty exit from the Islamabad High Court seemed to symbolise the diminished influence of a former army chief who once dominated Pakistan's political landscape, but whose bid to stage a triumphal comeback has garnered widespread scorn.
The order pushed Pakistan's increasingly audacious judiciary into uncharted territory, challenging a long-standing, unwritten rule that the top ranks of the army, which ruled Pakistan for decades, are untouchable.
"Islamabad High Court has cancelled Musharraf's bail and ordered his arrest," Mohammad Amjad, secretary-general of Musharraf's All Pakistan Muslim League party, told Reuters.
Amjad added that Musharraf's lawyers would lodge an appeal against the arrest order at the Supreme Court later in the day.
Despite Taliban death threats and a host of legal challenges, Musharraf returned from almost four years of self-imposed exile in London and Dubai last month in the hope of winning a seat in the National Assembly at the May 11 polls.
But his arrival has placed him at the mercy of judges whose memories are still raw of a showdown in 2007 when he sacked the chief justice, placed his colleagues under house arrest, and lawyers fought running battles with police.
Musharraf's hopes of standing in the elections were dashed earlier this week when election officers barred him from standing, in part due to the various legal challenges he faces.
On Thursday, a judge ordered he be detained in connection with allegations he committed treason during his 2007 confrontation with the judges when he declared emergency rule, a move which violated the constitution.
Pakistani television repeatedly broadcast footage of Musharraf dashing from the court in a black SUV as several disgruntled lawyers made half-hearted attempts to pursue his vehicle - a scene that would have been unthinkable just a few years ago when Musharraf was at the height of his powers.
Police made no immediate move to arrest Musharraf, who retreated to a farm in an exclusive residential estate on the outskirts of Islamabad.
Some commentators believe it is unlikely Musharraf, who seized power in a 1999 coup and resigned in 2008, will be arrested since the military would be unlikely to tolerate such a humiliating spectacle for a retired chief.
"I don't think the military establishment would support any move against him," said Mehdi Hasan, a newspaper columnist.
Although Musharraf's legal battles have provided an electrifying sideshow in the election race, he commands scant popular support and the outcome of the drama is unlikely to have much impact on the final results.
Former Prime Minister Nawaz Sharif, the man Musharraf ousted in a coup in 1999, is seen as the frontrunner to win the premiership.
Pakistan's military has ruled the nation for more than half of its 66-year history, through coups or from behind the scenes. It sets foreign and security policy even when civilian administrations are in power.
Pakistan's judiciary has, however, taken an increasingly assertive stance in recent years in confrontations with both the government and the army, and the arrest order against a former army chief is sure to rankle some in the military.
Musharraf's decision to return has mystified many Pakistanis, with commentators questioning whether he misjudged the degree of popular support he might be able to muster.
He faces charges of failing to provide adequate security for former prime minister Benazir Bhutto before she was assassinated in late 2007.
Musharraf also faces accusations in connection with the death of a separatist leader in the southwestern province of Baluchistan. He denies any wrongdoing.