Why were the AhlulBayt (as) Killed
Hadith 1:
إثبات الهداة: قالَ [الفَضلُ بنُ شاذانَ]: حَدَّثَنا عَبدُ اللَّهِ بنُ الحُسَينِ بنِ سَعدٍ الكاتِبُ، قالَ: قالَ أبو مُحَمَّدٍ عليه السلام: قَد وَضَعَ بُنو امَيَّةَ وبَنُو العَبّاسِ سُيوفَهُم عَلَينا لِعِلَّتَينِ
إحداهُما: إنَّهُم كانوا يَعلَمونُ أنَّهُ لَيسَ لَهُم فِي الخِلافَةِ حَقٌّ، فَيَخافونَ مِنِ ادِّعائِنا إيّاها وتَستَقِرُّ في مَركَزِها
وثانيهِما: إنَّهُم قَد وَقَفوا مِنَ الأَخبارِ المُتَواتِرَةِ، عَلى أنَّ زَوالَ مُلكِ الجَبابِرَةِ وَالظَّلَمَةِ عَلى يَدِ القائِمِ مِنّا، و كانوا لا يَشُكّونَ أنَّهُم مِنَ الجَبابِرَةِ وَالظَّلَمَةِ، فَسَعَوا في قَتلِ أهلِ بَيتِ رَسولِ اللَّهِ صلى الله عليه و آله وإبادَةِ نَسلِهِ؛ طَمَعاً مِنهُم فِي الوُصولِ إلى مَنعِ تَوَلُّدِ القائِمِ أو قَتلِهِ، فَأَبَى اللَّهُ أن يَكشِفَ أمرَهُ لِواحِدٍ مِنهُم، إلّاأن يُتِمَّ نورَهُ ولَو كَرِهَ الكافِرونَ
Narrated that Abu Muhammad Imam Hasan Askari (عليه السلام) said, "The Banu Umayyah and the Banu Abbas put their swords against Us for two reasons:
The first reason is that they knew they had no right to the caliphate, so they feared Our claim to it and that it would settle in its true position.
The second reason is that they were informed of the repeated (Mutawatir) reports that the rule of the tyrants and oppressors will end upon the hand of the Qaim (عليه السلام) from among Us. And they did not doubt that they were among the tyrants and oppressors, so they made every effort in killing the family of the Messenger of Allah (صلى الله عليه وآله), and annihilating His progeny, hoping to prevent the birth of the Qaim (عليه السلام) or to kill Him. However, Allah refused to reveal His matter to any of them - except to perfect His light, even if the disbelievers detest it."
[Source: Mukhtasar Isbaath al-Rajah, al-Fadhl bin Shazaan, Hadith. 13 / Isbat al-Huda – Shaikh Hurr al-Amili, Vol. 5, Pg. 197]
Hadith 2:
From a long hadith narrated from Imam Sadiq (عليه السلام) about Imam Mahdi (عليه السلام):
قال: أما مولد موسى عليه السلام، فإن فرعون لما وقف على أن زوال ملكه على يده أمر بإحضار الكهنة فدلوا على نسبه وأنه يكون من بني إسرائيل، فلم يزل يأمر أصحابه بشق بطون الحوامل من نساء بني إسرائيل حتى قتل في طلبه نيفا وعشرين ألف مولود، وتعذر عليه الوصول إلى قتل موسى عليه السلام بحفظ الله تعالى إياه. كذلك بنو أمية وبنو العباس لما أن وقفوا على أن به زوال مملكة الأمراء والجبابرة منهم على يدي القائم منا ناصبونا العداوة ووضعوا سيوفهم في قتل أهل بيت رسول الله صلى الله عليه وآله وسلم وإبادة نسله، طمعا منهم في الوصول إلى قتل القائم عليه السلام. فأبى الله أن يكشف أمره لواحد من الظلمة إلا أن يتم نوره ولو كره المشركون.
"As for the birth of Musa: When Firon learned that the end of his kingdom is going to be at the hands of Musa (عليه السلام), he ordered to bring forth the fortune tellers, who foretold him about his lineage and that he will be from the Children of Israel (Bani Israel). So Firon continued to command his companions to rip open the abdomens of pregnant ladies from Bani Israel, until he killed in the pursuit of Musa, twenty and some odd thousand babies. And it was impossible for him to reach Musa (عليه السلام) due the protection of Allah (تعالى).
Similarly, when the Banu Umayyah and the Banu Abbas learned that the end of their kingdom and that of their kings and their tyrants will be at the hands of the Qaim (عليه السلام) from Us, they showed enmity to Us and took their swords out for killing the AhlulBayt of the Messenger of Allah (صلى الله عليه وآله) and completely finishing His progeny hoping to reach the killing of the Qaim (عليه السلام). However, Allah refused to reveal His Command for one of the oppressors, until His light is completed, even though the Unbelievers may dislike"
[Source: al-Ghaybah, Shaikh Toosi, Pg. 193]