ISLAMABAD, April 18 — When the former military ruler Pervez Musharraf ended his years of exile last month, it was with a vision of himself as a political savior, returning in the nick of time to save Pakistan from chaos.
Instead, he contributed a new and bizarre chapter to the country’s political turmoil on Thursday, fleeing the halls of the High Court after a judge ordered his arrest. Speeding away in a convoy of black S.U.V.’s as a crowd of lawyers mocked him, he hurried to his fortress compound outside of the capital, where he was later declared under house arrest.
Less than five years after wielding absolute power, the retired four-star general has become the latest example of the Pakistani judiciary’s increasing willingness to pursue previously untouchable levels of society — even to the top ranks of the powerful military.
Never before has a retired army chief faced imprisonment in Pakistan, and analysts said the move against Mr. Musharraf could open a new rift between the courts and the military.
All this comes at a delicate moment for Pakistan, with elections near and only a temporary caretaker government at the helm. Though army commanders have sworn to stay on the sidelines in this election, there is fear that any tension over Mr. Musharraf’s fate could make the military more politically aggressive.
It was perhaps with that potential conflict in mind that the country’s Supreme Court was reported by Mr. Musharraf’s aides to have deputized his luxury villa — secured by both retired and serving soldiers — as a “sub-jail” late Thursday night rather than demanding that he appear outside the compound’s walls for arrest.
The tight security at his home, ringed by guard posts and barbed wire, was at first a reflection of repeated Taliban threats to kill the former general. But for now, the imminent danger to Mr. Musharraf, who ruled Pakistan between 1999 and 2008, stems from the courts.
At Thursday’s hearing, the High Court judge, Shaukat Aziz Siddiqui, refused to extend Mr. Musharraf’s bail in a case focusing on his controversial decision to fire and imprison the country’s top judges when he imposed emergency rule in November 2007.
Resentment toward the former army chief and president still runs deep in the judiciary, which was at the center of the heady 18-month protest movement that led to his ouster in 2008.
Mr. Musharraf’s fledgling All Pakistan Muslim League party was cast into crisis. A spokesman for the party described the court order as “seemingly motivated by personal vendettas,” and hinted at the possibility of a looming clash with the military, warning that it could “result in unnecessary tension among the various pillars of state and possibly destabilize the country.”
Mr. Musharraf’s lawyers immediately lodged an appeal with the Supreme Court, which rejected it. The legal team said it would try again on Friday.
The court drama represents the low point of a troubled homecoming for the swaggering commando general, who had vowed to “take the country out of darkness” after returning from four years of self-imposed exile in Dubai, London and the United States.
But instead of the public adulation he was apparently expecting, Mr. Musharraf has been greeted by stiff legal challenges, political hostility and — perhaps most deflating — a widespread sense of public apathy.
Pakistan’s influential television channels have given scant coverage to Mr. Musharraf since his return, and his party has struggled to find strong candidates to field in the general election scheduled for May 11. On Tuesday, the national election commission delivered another blow, disqualifying Mr. Musharraf from the election.
The army, once the source of Mr. Musharraf’s power, has offered little in the way of succor, apart from some armed security.
Meanwhile, Mr. Musharraf faces criminal charges in three cases dating to his period in office — the one related to firing judges and two others related to the deaths of the former Prime Minister Benazir Bhutto and Nawab Akbar Khan Bugti, a Baloch tribal leader. Attempts by some critics to charge Mr. Musharraf with treason have not succeeded.
At times, the self-described elite soldier seemed bent on shooting himself in the foot. In an interview with CNN last week, he admitted to having authorized American drone strikes in the tribal belt — a statement that contradicted years of denials of complicity in the drone program, and which was considered politically disastrous in a country where the drones are widely despised.
In returning home in such an apparently ill-considered manner, Mr. Musharraf has placed himself at the mercy of some of his most bitter enemies.
The favorite to win the coming election is Nawaz Sharif, the onetime prime minister whom Mr. Musharraf overthrew to seize power in 1999.
Meanwhile, the Supreme Court is led by his sworn enemy, Chief Justice Iftikhar Muhammad Chaudhry, whom Mr. Musharraf fired and placed under house arrest in 2007. Justice Siddiqui, who refused him bail on Thursday, is considered a conservative who has been hostile to the military.
Last week, another judge placed Mr. Musharraf on the Exit Control List, which means that he cannot leave the country until a court gives him permission.
In his 2006 memoir, “In the Line of Fire,” Mr. Musharraf wrote: “It is not unusual in Pakistan for the general public and the intelligentsia to approach the army chief and ask him to save the nation.” But as the events of Thursday suggested, it is the former army chief who may need saving this time.
Salman Masood contributed reporting.