Former Pakistani military ruler Pervez Musharraf vowed on Friday to fight what he called politically motivated allegations against him, following his arrest in a case involving his decision to fire senior judges while in power.

Musharraf was detained after he made a dramatic escape from court in a speeding vehicle on Thursday and holed up in his heavily guarded house on the outskirts of Islamabad. He is now being held at police headquarters in the capital and is expected to appear before an anti-terrorism court.

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 to Pakistan last month after four years in self-imposed exile to make a political comeback despite Taliban death threats and a raft of legal challenges. But he was disqualified from running in the May 11 parliamentary election earlier this week, and his fortunes have gone from bad to worse since then.

Musharraf’s 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 it’s aura of impunity has declined in recent years, especially in the face of an activist judiciary.

There were conflicting reports on Friday about how Musharraf was arrested. Police said he was taken into custody overnight at his home and brought before a magistrate in Islamabad in the morning. But the secretary general of Musharraf’s party, Mohammed Amjad, claimed the former military ruler surrendered himself before the magistrate.

Local TV video showed Musharraf entering the court Friday, surrounded by a heavy security detachment of police and paramilitary soldiers.

He was eventually taken to a rest house at the main police headquarters in Islamabad, where he will be held until he is presented before an anti-terrorism court. That is expected to take place within 48 hours, said two police officials, speaking on condition of anonymity because they were not authorized to talk to the media.

Musharraf’s latest drama began with a judge on Thursday ordering his arrest after the former military ruler appeared in court to request a bail extension. The judge said Musharraf’s decision in 2007 to dismiss senior judges, including the chief justice of the Supreme Court, spread terror among the legal community and the country.

“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 Friday after he was arrested.

His arrest ended an awkward situation in which Musharraf was being protected by security forces for hours at his house but none of them made a move to detain him, likely awaiting orders from senior officials trying to figure out how to deal with the delicate situation.

Musharraf sacked the judges after declaring a state of emergency and suspending the constitution. He was apparently concerned the judges would challenge his re-election as president, and he cited the growing Taliban insurgency in the country as justification for the state of emergency.

Musharraf’s crackdown on the judges outraged many Pakistanis and fueled a nationwide protest movement by lawyers that eventually resulted in him stepping down under threat of impeachment.

Many Pakistanis disapproved of Musharraf’s return in the run-up to a historic election. The upcoming vote will mark the first time parliament has completed a full five-year term and transferred power in democratic elections.