RABWAH, Pakistan — The guard inched open the metal gate of the giant mosque compound, cast a wary glance at the empty street and with a cagey wave of his hand said, “Come in.”

It was a Tuesday afternoon in Rabwah, the time for the midday prayer performed daily by Muslims, but the sprawling halls of Masjid-e-Aqsa, the largest mosque of the Ahmadi sect in Pakistan, stood empty. Paint peeled off the walls. A giant clock near the dusty pulpit read 8:44, no longer keeping time.

Though Ahmadi beliefs are deeply rooted in Islam, orthodox Muslims consider them heretical. The Pakistan Constitution declared them non-Muslims after anti-Ahmadi riots in 1974, and a 1984 ordinance forbade their “posing as Muslims” — performing the Muslim call to prayer, publicly using Islamic greetings, disseminating religious literature or even calling their places of worship mosques.

The legal changes have left the sect particularly vulnerable, and attacks on Ahmadi businesses, places of worship and graveyards are common. Since twin attacks on Ahmadi mosques in Lahore in 2010 left 93 people dead, Rabwah’s Masjid-e-Aqsa, where 20,000 people would gather at a time, has been abandoned for smaller neighborhood mosques.