The point here is that the hadith mentioning twelve caliphs refers to the earlier caliphs from Quraysh, whether ‘Alī is understood to be included among them or not. ‘Alī was undoubtedly the person most entitled to the caliphate in his time, as none of the scholars doubts.
[Section: His claim of merit through kinship and the response to it]
Section
With this established, the merits he has mentioned concerning ‘Alī, insofar as they are merits in Allah’s sight, are true. Yet the three caliphs possess still greater merits.
As for the merit he claims on account of kinship, there are several responses.
First: this is not a merit in Allah’s sight, so it carries no weight. Al-‘Abbās was more closely related to the Prophet than ‘Alī was. Hamzah was among the earliest forerunners of the Emigrants, and it has been reported that he is “the foremost of the martyrs” (1). He too was more closely related to the Prophet than ‘Alī was.
The Prophet—may Allah bless him and grant him peace—had many paternal cousins, such as Ja‘far and ‘Aqīl; ‘Abd Allāh (2), ‘Ubayd Allāh, al-Fadl, and other sons of al-‘Abbās; and Rabī‘ah and Abū Sufyān ibn al-Hārith ibn ‘Abd al-Muttalib.