A Pakistani court ordered former military ruler Pervez Musharraf to be remanded in custody for two weeks on Saturday but he will be allowed to stay at his plush villa, officials said.
His arrest Friday ahead of key elections relates to Musharraf's decision to sack judges when he imposed emergency rule in November 2007, a move that hastened his downfall.
"The court has sent General Musharraf on judicial remand for two weeks," Muhammad Amjad, spokesman for Musharraf's All Pakistan Muslim League party, told reporters.
"Our lawyers denied the allegations that General Musharraf sacked judges and kept them and their families under house arrest for six months. It is absolutely untrue," Amjad said.
"We had requested the court to send General Musharraf on judicial remand, so that we can go to higher courts for relief," he added.
Musharraf appeared before the anti-terrorism court amid tight security, as hundreds of lawyers opposing him scuffled with security personnel and shouted slogans against the former ruler.
The shouted slogans including: "Go Musharraf, Go!" "Countless curses on Musharraf!" and "Whosoever is a friend of Musharraf is a traitor!"
He had spent the night at police headquarters in Islamabad, officials said, and was moved back there after his court appearance.
Later in the afternoon Musharraf was taken to his villa and armed security personnel deployed around it, they said.
Live television footage showed Musharraf and prison staff arriving at the fortified luxury farmhouse.
Musharraf's return there saves him the hardships of a Pakistani prison, where police said he would face "security threats".
"Islamabad administration has declared General Musharraf's house a sub-jail and he will be kept there during the remand period and all jail rules will apply to the building," a senior police official told AFP.
"The police had requested the administration that in jail there were serious security threats to Musharraf so he should be confined at his farmhouse," the official said.
Musharraf was taken into police custody after being arrested on Friday, an unprecedented move against a former army chief of staff.
Live television footage showed Musharraf getting out of his white bullet-proof SUV and being surrounded by dozens of security guards as he was brought into the courthouse.
Lawyers have petitioned Pakistan's top court to try him for treason for imposing emergency law -- which would be punishable by death or life in prison -- but it would have to be the state that initiates any trial.
The Supreme Court on Saturday named a three-judge panel to resume hearing petitions seeking Musharraf's trial under the High Treason Act from Monday.
He also faces charges of conspiracy to murder opposition leader Benazir Bhutto in 2007 and over the death of a rebel leader during a 2006 military operation.
Musharraf's supporters say the arrest order was nothing more than a settling of scores for his dismissal of judges nearly six years ago.
On Thursday, Judge Shaukat Aziz Siddiqui added terrorism to the charges, accusing him of spreading "fear in the society, insecurity amongst the judicial officers, alarm in the lawyers' community and terror throughout Pakistan".
Musharraf seized power in a bloodless coup, which was widely welcomed at the time in Pakistan, but he was forced out and threatened with impeachment in 2008.
The elected prime minister he ousted, Nawaz Sharif, is now the front-runner in the general election campaign.