The cleric’s brother, Abdul Rashid Ghazi, and his elderly mother died in the firefight. After the siege was over, Mr. Aziz was charged with murder, abduction, arson and terrorism. Yet within a couple of years, the mosque and Mr. Aziz were back in business.

Malik Riaz Hussain, a sympathetic property tycoon, provided a temporary home for hundreds of madrasa students and spent at least $150,000 on refurbishing the bullet-pocked mosque. He attributed his generosity to pragmatism rather than to religious conviction.

“I have huge interests in Islamabad and Rawalpindi,” the businessman, who has close ties to the military, told The New York Times in a 2010 interview. “Bad law and order is bad for my business.”

The city provided land worth millions of dollars in central Islamabad for the rebuilding of Jamia Hafsa, a women’s madrasa that was bulldozed after the 2007 siege. The madrasa, whose construction is not complete, is home to the Osama bin Laden library.

But it is the courts that have been most indulgent toward Mr. Aziz and his followers. Over the past year, judges have dismissed all of the 27 criminal charges against Mr. Aziz, who at times has used the courtroom as a pulpit to call for the imposition of Shariah law.

Instead, the court’s attention has mostly focused on Gen. Pervez Musharraf, Pakistan’s former military ruler. A judicial inquest determined that General Musharraf, not Mr. Aziz, was responsible for the deaths during the siege of the Red Mosque, even though armed jihadis from banned militant groups had joined the students inside.

In October, a senior judge, prompted by Mr. Aziz’s lawyers, charged General Musharraf for his role in the siege and placed him under house arrest. In recent weeks the Martyrs Foundation, a group that represents the families of students who died in the siege, petitioned the Supreme Court to prevent General Musharraf from leaving Pakistan until the completion of his treason trial, underway now.