A court in Pakistan on Friday ordered former military ruler Pervez Musharraf to be held for 14 days over a 2007 raid on a radical mosque, a decision that means he must remain confined to his villa.

Police arrested Musharraf late on Thursday over the military raid on the Red Mosque which left dozens dead a day after a court granted him bail in a separate case.

The 70-year-old has been confined to his villa on the edge of Islamabad, which has been declared a "sub-jail" since April over a string of cases dating back to his 1999-2008 rule.

The Supreme Court on Wednesday granted him bail over the death of a rebel leader, a move that could have seen him freed once release procedures were completed.

He had already been granted bail in two other major cases against him, including one relating to the assassination of former prime minister Benazir Bhutto.

"The court remanded Musharraf for 14 days. The next date of hearing has been fixed for October 25," a court official told AFP.

Musharraf's lawyer Afshan Adil confirmed the details of the order.

The former commando returned to Pakistan in March to run in the May general election, vowing to "save" the country from economic collapse and militancy.

But he was barred from standing in the election, won convincingly by Prime Minister Nawaz Sharif -- the man he ousted from power in 1999 -- and was hit with a barrage of criminal cases dating back to his rule.

Taking the former chief of army staff into custody was an unprecedented move in a country ruled for more than half of its life by the military. It was seen by many as a challenge to the power of the armed forces.

Though Musharraf's lawyers said Wednesday's bail order meant he was a "free man", in practice his life is in such danger that he cannot leave his villa, where he is guarded by 300 heavily-armed police and soldiers.

The Taliban have threatened to kill the 70-year-old former general, who as president allied Pakistan with Washington in the US "war on terror" in the wake of the 9/11 attacks.

Since Sharif won the election there have been repeated rumours that a deal would be reached to allow Musharraf to leave Pakistan before his trials were completed.

One theory was that Musharraf might be allowed to visit his sick elderly mother in Dubai on compassionate grounds.

But interior ministry officials confirmed to AFP that his name remains on the "exit control list", meaning he is officially barred from leaving Pakistan.