The Ahmadiyya case is the clearest example in the modern world of a state deciding who counts as a member of a religion, and the sequence is a matter of legislative record rather than interpretation.
In 1974 the Parliament of Pakistan amended the constitution to define Ahmadis as non-Muslims for the purposes of law. In 1984 a presidential ordinance added criminal penalties: Ahmadis may not call their places of worship mosques, may not make the call to prayer, may not use Islamic greetings or forms, and may not directly or indirectly pose as Muslims, on pain of imprisonment. Applicants for a Pakistani passport must sign a declaration repudiating Ahmad in order to be recorded as Muslim. Ahmadis are effectively disenfranchised, since the electoral arrangement requires them to register on a separate list as non-Muslims, which the community refuses to do.
The consequences have included the destruction of mosques and graves, the murder of individuals, and coordinated attacks on worshippers, most severely the assault on two Ahmadi places of worship in Lahore in 2010 that killed more than eighty people. Saudi Arabia bars Ahmadis from the pilgrimage, so the community holds the Hajj obligatory in its teaching while being prevented from performing it. Restrictions of varying severity exist in several other Muslim-majority countries, including Indonesia, Bangladesh and Algeria.
The community's own estimate of its size runs into the tens of millions worldwide; independent estimates are considerably lower and generally place it in the low millions, with significant populations in Pakistan, India, Indonesia, Ghana, Nigeria and among diaspora communities in Britain, Germany and Canada. No neutral census exists, and in Pakistan the legal position guarantees that none can.
The community's public motto, love for all, hatred for none, is maintained without apparent modification through all of this.