Sayyed Muhammad Husaini Ragheb, Sayyed Muhammad Husaini Ragheb has a BA in Law from Guilan University, Iran and has also undertaken Hawzah studies in Qom. He is a Cultural Affairs director of Ethics Group of Al-Mustafa Open... Answer updated 10 months ago

Salaam
There are narrations from Ahlul Bait in this regard like:

  1. عن امیرالمؤمنین (ع) لایصلین احدکم خلف المجنون و ولدا الزنا وسائل الشیعة
  2. مَعْرُوفٍ عَنْ أَبِی جَمِیلَةَ عَنْ سَعْدِ بْنِ طَرِیفٍ عَنِ الْأَصْبَغِ بْنِ نُبَاتَةَ قَالَ سَمِعْتُ أَمِیرَ الْمُؤْمِنِینَ ع یَقُولُ سِتَّةٌ لَا یَنْبَغِی أَنْ یَؤُمُّوا النَّاسَ وَلَدُ الزِّنَا وَ الْمُرْتَدُّ وَ الْأَعْرَابِیُّ بَعْدَ الْهِجْرَةِ وَ شَارِبُ الْخَمْرِ وَ الْمَحْدُودُ وَ الْأَغْلَفُ
  3. and a narration from Imam Muhammad ibn Ali al-Baqer in which he says don't pray behind 5 types of people one of which is a child out of wedlock.

    Plus that is the consensus of Shia scholars on this ruling.

    The word Imam means Muqtada, a leader and someone whom others follow and set an example in their works. And the Imam of the congregation is the one whom the group and the congregation set as their role model. Therefore, there should not be a defect in the position of the incumbent, although he himself has not interfered in achieving this defect. To explain that, the fact that an illegitimate child is deprived of some social and spiritual positions such as Imamate of the congregation and the authority of Taqlid, etc., which are the contents of some above mentioned narrations, is because of the nature of these positions and it does not mean deprivation of salvation on the Day of Judgment, for example, a blind person can not be in charge of some positions or a person who is very forgetful can not be a judge even if he has not committed the slightest sin in his life, having a good memory is one of the conditions of a judge. But these deprivations have nothing to do with one's felicity or unhappiness(i.e. bad end), and so is that with the illegitimate child, and our proof is that in the same narrations, the illegitimate child is placed next to the insane and the leper, etc., even though someone is not crazy or is not leper by their own will.

    From a social point of view, being an illegitimate is also a kind of defect and does not lead to reputation, because on the one hand, illegitimacy is the product of a shameful act, and on the other hand, most of the illegitimate children have not shown an acceptable record throughout history, and this is certain that in holding some positions, a person should be away from the characteristics and traits that cause hatred and distance from people, even if those characteristics have been imposed on him without authority.