Pakistan's Supreme Court has demanded the government explain its decision to send troops into the controversial Red Mosque in Islamabad last month.
Soldiers overran the mosque amid fierce gun battles
More than 100 people were killed when security forces stormed the mosque to flush out Islamic militants.
The attack marked the end of an eight-day siege after vigilante attacks by mosque students seeking to impose Islamic Shariah law in the capital.
Since the operation attacks on the security forces have soared.
Judge Javed Iqbal ordered the interior ministry and other government departments to provide answers about the siege and storming of the mosque.
"The legality of the operation needs to be explained," he said.
The court also heard a petition filed by the national association of seminaries (madrassas), which says it wants to establish who was responsible for casualties during the siege and raid on the mosque.
The association has put forward 25 questions it wants answered.
RED MOSQUE STAND-OFF
3 July: Clashes erupt at mosque, 16 killed, after long student campaign for Islamic Sharia law
4 July: About 700 students leave mosque, now besieged by security forces; mosque leader caught trying to flee wearing woman's burka
5 July: More than 1,000 students surrender to security forces
6 July: Women are allowed to leave the mosque; students' deputy leader says he would rather die than surrender
8 July: Ministers say wanted militants are holding women and children inside the mosque
9 July: Negotiators talk to mosque leader via loudspeaker without progress; three Chinese workers are killed in Peshawar over siege
10 July: Pakistani troops storm mosque after failure of talks; army says Ghazi killed
11 July: Pakistani army says all militants cleared from mosque
These include whether an agreement was reached with the deputy head of the mosque, Abdul Rashid Ghazi, and, if so, why was it thrown aside.
Judge Iqbal ordered the government to submit comprehensive answers to all the questions.
Security forces raided the mosque and its attached Jamia Hafsa seminary on 10 July.
Officials say about 100 people were killed during the raid. These include women and children who were inside the mosque at the time.
But media reports and right-wing groups have suggested the figure was actually much higher.
"We intend to file murder cases against officials including President Musharraf," a lawyer for the petitioners, Iftikhar Gillani, said in court.
"They are all responsible for the bloodbath in the Red Mosque."
The Supreme Court has given the government four weeks to submit a detailed reply on the matter.
Meanwhile, the government has released all but one of the remaining detainees held during the mosque operation.
The only exception is Maulana Abdul Aziz, the head of the mosque, who is still in custody. He was arrested while trying to flee the complex dressed in a burka.
On Monday, 19 seminary students along with Maulana Aziz's daughter and wife were granted bail.
In addition, Khalid Khawaja, an ex-secret services official and now a human rights activist who is also charged in the case, was granted bail and freed.
THE RED MOSQUE SIEGE
1 Special forces attack compound from three sides and breach mosque walls
2 Fierce fighting between military and militants on mosque roof
3 Military take control of mosque and clear building
4 Militants fire from mosque minarets as action switches to madrassa
5 Remaining militants holed up in its basement, with women and children