Abū Shuʿayb Muḥammad ibn Nuṣayr, was a disciple of the tenth Twelver Imam, Ali al‐Hadi and of the eleventh Twelver Imam, Hasan al‐Askari (d. 873). Ibn Nusayr was known to his companions as a representative (bāb) of al‐Askari and of the twelfth Twelver Imam, Muhammad al‐Mahdi during the Minor Occultation. A rival of his in claiming to be the bāb (door) to the Imams was Abu Yaqub Ishaq, founder of the Ishaqiyya.
Historian Matti Moosa claims he believed in the divinity of al‐Askari, reincarnation, and the lawfulness and praiseworthiness of homosexuality.
The followers of Ibn Nusayr are known as the Nusayris (Arabic: نصيريون) or, since the 1920s, the Alawis (Arabic: علوي). Nusayr was of Persian origin, but was associated with the Arab al‐Namir tribe.
After the death of al‐Askari the Shia community was faced with the issue of who the Imam's successor was, the solution that was later presented was that al‐Askari left a secret son (Muhammad al‐Mahdi, obviously so named to fulfill the tradition that the Mahdi would have the same name as the Prophet) who communicated with the Shiites via representatives. Ibn Nusayr claimed to have been intimate with the tenth and eleventh Imams, and upon hearing of the “news of the hidden son” similarly attempted to claim that he was a representative of the hidden Imam. His claim was rejected by the mainstream Shiites, and Nusayr was later excommunicated by Abu Jafar Muhammad ibn Uthman, the official “second deputy” of the “hidden Imam.”
Nusayr was also prone to these antics earlier in his career when he claimed al‐Hadi was in fact divine and that he had been sent by al‐Hadi as a prophet, because of this he was officially “cursed” by the Shia community. The second “curse” was when he claimed to be the gate (bāb) of al‐Askari. At any rate the gist is that Nusayr laid claim to being the most intimate of intimates of the tenth and eleventh Imams. The death of al‐Askari and the confusion as to his successor produced a schism in which Nusayr was officially “banished” from the Shia community. The mainstream (Twelver) Shias therefore were headed by the Four Deputies whereas the Nusayris went underground.