A Pakistani judge on Saturday ordered former military ruler Pervez Musharraf be held in custody for two weeks until the next hearing in a case related to his 2007 decision to sack and detain several judges.
The police then declared Musharraf's lavish country residence a jail, paving way for him to be taken and held there under what is essentially house arrest.
The development is the latest act in the drama surrounding Musharraf that erupted earlier this week and climaxed with his arrest Friday after a speedy escape from another court hearing.
The former general, who seized power in a coup and ruled Pakistan for nearly a decade, has seen his fortunes plummet since he returned in March after four years in self-imposed exile.
The arrest of such a prominent military figure in a country that has experienced three coups has unsettled Pakistan at a time when it is preparing for historic elections on May 11.
Saturday's order came at a hearing in an Islamabad court, where Musharraf was brought under heavy security as supporters and opponents gathered outside the court.
The judge ruled that he would be given judicial remand, which means that he would be held in custody until the next hearing on May 4. Musharraf's legal team had been pushing to get his estate on the edge of Islamabad declared a sub-jail under Pakistani law.
The Islamabad chief commissioner later issued a notification declaring the residence a jail, said police official Mohammed Khalid. Musharraf, who was taken from the court back to the police guesthouse where he had spent the night, was to be transported later Saturday to his private house in the country to remain there under house arrest.
Musharraf was arrested in the case that stems from his decision, while in power, to sack and detain the judges, including the country's chief justice, after declaring a state of emergency and suspending the constitution.
At the time, Musharraf was apparently concerned the judges would push back against his re-election as president. As a justification for the state of emergency he also cited the growing Taliban insurgency in the country's northwest.
But the move backfired horribly. The country's lawyers took to the streets in widespread protests that eventually weakened Musharraf's government so much that he was forced to call new elections and step down.
A judge has said Musharaf's 2007 decision amounted to terrorism, which is why the case is now being heard before an anti-terrorism court. Such courts are closed to the media and the public.
Musharraf returned to Pakistan last month to make a political comeback and contest the May 11 election. But he was greeted with little popular support and was disqualified from running in the election. A judge on Thursday ordered his arrest.
That sparked a dramatic escape by Musharraf from court in a speeding vehicle after which he holed up in his heavily guarded house on the outskirts of Islamabad until he was taken into custody on Friday morning.
Musharraf seized control of Pakistan in a coup in 1999 when he was army chief and spent nearly a decade in power before being forced to step down in 2008. He returned despite Taliban death threats and a raft of legal challenges.
He also faces legal charges in connection with the 2007 assassination of the former prime minister Benazir Bhutto and the 2006 death of a Baluch nationalist leader.
But it has been the case of the judges that has sparked the most contention since Musharraf's return — a reflection of the deep animosity many in the legal sphere still have for the former strongman.
His arrest is a significant act in a country where senior army officers have long seemed untouchable. The army is still considered the most powerful institution in Pakistan, but its aura of impunity has declined in recent years, especially in the face of an activist judiciary.
When Musharraf entered the court Saturday, he was surrounded by a phalanx of police and paramilitary Rangers. Pakistani lawyers chanted: "Whoever is a friend ofMusharraf is a traitor," while supporters shouted: "Love live Musharraf!"
Musharraf has described the allegations as politically motivated.
"These allegations are politically motivated, and I will fight them in the trial court, where the truth will eventually prevail," Musharraf said in a message posted on his Facebook page after his arrest.
Musharraf had hoped to regain some of his power by winning seats in the May 11 election. That vote will mark a significant milestone for Pakistan which has seen its democratic evolution stalled by a history of military coups.
But militancy and violence will likely continue to be a problem for whoever ends up running the country.
On Saturday, a suspected suicide bomber targeted security forces outside the main gate of a hospital in Khar, the main town in the Bajur tribal region. Four people died in the blast, said political administration official Abdul Haseeb Khan.
The tribal regions border Afghanistan to the west and have been the scene of numerous attacks by militants opposed to the Pakistani government who want to impose their version of Islam on the rest of the country.