The former military ruler has already got bail in two other cases - the 2007 assassination of former prime minister Benazir Bhutto and the killing of senior tribal leader Nawab Akbar Bugti in a 2006 military operation.
Additional Session Judge Wajid Ali ordered that Musharraf should be released after his lawyers deposited two surety bonds, reported Xinhua.
Lawyers said Musharraf is likely to be set free later Wednesday after the written order is delivered at his farmhouse in Islamabad where he has been detained for several months.
Musharraf's defence lawyer Ilyas Siddiqi said the former President is now a free man and that he can go anywhere he wants.
"Pervez Musharraf has been granted bail in all cases. There are no restrictions on his movement," Siddiqi told reporters.
The lawyer also demanded the removal of Musharraf's name from the Exit Control List.
Musharraf was formally arrested in the case filed in connection with the alleged murder of Abdul Rashid Ghazi, the senior cleric of the Red Mosque who was killed in the military operation during Musharraf's rule in 2007.
Nearly 90 religious students and 11 security personnel also died during the three-day clash in July 2007.
Musharraf was accused of issuing orders for the military raid on the mosque and its girls' religious school after some of the armed students took control of the buildings and refused to surrender.
Musharraf's lawyers argued in the court that the former President had not issued any written order for the military raid on the militant-affiliated mosque.
The former military ruler has already got bail in two other cases.
It is widely believed that bail to Musharraf in the mosque case has paved the way for his going abroad. However, Musharraf's lawyer insisted that the former military dictator will not leave the country.Musharraf returned to Pakistan in March after a nearly four-year self imposed exile to take part in elections. However, a court disqualified him from standing in the May elections.
Interior Minister Chaudhry Nisar Ali Khan had said Musharraf cannot leave the country as his name is included in the list of those who are barred from going abroad."Musharraf's name is on Exit Control List and it would not be removed until the court's decision," Khan told reporters last week.
The former military ruler also faces high treason charges as he had suspended the constitution and imposed emergency in 2007. The high treason case was initiated after Prime Minister Nawaz Sharif announced in June that his government had formally approached the Supreme Court for Musharraf's trial.