All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
History books mention among the incidents that took place in 317 A.H. that the Qaraamitah (Qaramites, a heretical Shi’ite group) transgressed the House of Allaah on the Day of Tarwiyyah (the 8th of Thul-Hijjah) and they killed the pilgrims and plundered them. They took the Black Stone and transgressed the Haram (the House of Allaah), and showed their disbelief and atheism. They were allies to the Fatimids and to their leader ‘Ubaydullaah ibn Maymoon Al-Qaddaah, who was nicknamed Al-Mahdi and then he claimed to be a descendant of Faatimah the daughter of the Prophet, sallallaahu ‘alayhi wa sallam. A large group of Berbers believed him, and he formed a state.
Ibn Katheer in his book Al-Bidaayah wan-Nihaayah quoted Ibn Al-Atheer to have said in his history book that the Mahdi wrote to Abu Taahir Al-Qarmati [the leader of the Qaraamitah] blaming him about what he had done in Makkah as he caused people to criticize them [for what had happened in Makkah], and their secrets which they used to hide were exposed. So, he ordered him to bring back what he took from it [Makkah] and he (Abu Taahir) wrote to him expressing his obedience to him and he fulfilled what he was ordered to do, and so he returned the Black Stone [to Makkah].
For more information on the Qaraamitah, please refer to Fatwa 16666.
Allaah Knows best.