[Machine] The Messenger of Allah ﷺ entrusted the flag to Ali on the day of Badr, when he was twenty years old. Imam Ahmed said, "The battle of Badr took place a year and a half after the Prophet ﷺ arrived in Medina. There is disagreement about Ali's age when he received the flag. Some say he was ten, others say thirteen, and some say fifteen. If he was ten, and it is confirmed that Ali was twenty years old on the day of Badr, it means he returned to Mecca when he was only a little older than that." Urwah ibn Al-Zubair said, "If he was thirteen or fifteen, then he would have been younger than that." Allah knows best. There is also disagreement about Ali's age when he was killed. Some say he was sixty-five, others say he was sixty-three, and some say he was younger than that. The most famous opinion is that he was sixty-three, with him being forty years old when the Prophet ﷺ migrated to Medina. His age when he embraced Islam was influenced by the opinion of those who said that the Prophet ﷺ stayed in Mecca for ten to thirteen years before migrating, and by the opinion of those who said that the migration was earlier, from thirteen to fifteen years before. Some said that Ali's age when he prayed with the Prophet ﷺ was an age at which puberty could possibly occur. The poetry that has been narrated is open to interpretation, and its chain of narrators is weak. The ruling on the authenticity of the statement of an adult over that of a distinguishing child is controversial. Ali's ruling of embracing Islam was influenced either because he had remained until the description of Islam was offered after he reached puberty, or because the Prophet ﷺ had specifically called him to Islam, unlike other children who were not addressed. Or it could be because the ruling of a distinguishing child at that time was decided before the arrival of the Islamic law. It could also have been because he had reached puberty through a wet dream, and he became an adult by it. Allah knows best. Al-Hasan Al-Basri and others have narrated from Qatadah that Ali embraced Islam at the age of fifteen or sixteen, as mentioned before.
أَنَّ رَسُولَ اللهِ ﷺ دَفَعَ الرَّايَةَ إِلَى عَلِيٍّ يَوْمَ بَدْرٍ وَهُوَ ابْنُ عِشْرِينَ سَنَةً قَالَ الْإِمَامُ أَحْمَدُ رَحِمَهُ اللهُ وَوَقْعَةُ بَدْرٍ كَانَتْ بَعْدَمَا قَدِمَ رَسُولُ اللهِ ﷺ الْمَدِينَةَ بِسَنَةٍ وَنِصْفِ سَنَةٍ وَاخْتَلَفُوا فِي قَدْرِ مُقَامِهِ بِمَكَّةَ بَعْدَمَا بُعِثَ فَقِيلَ عَشْرًا وَقِيلَ ثَلَاثَ عَشْرَةَ سَنَةً وَقِيلَ خَمْسَ عَشْرَةَ سَنَةً فَإِنْ كَانَ عَشْرًا وَصَحَّ أَنَّ عَلِيًّا كَانَ ابْنَ عِشْرِينَ سَنَةً يَوْمَ بَدْرٍ رَجَعَ سِنُّهُ يَوْمَ أَسْلَمَ إِلَى قَرِيبٍ مِمَّا قَالَ عُرْوَةُ بْنُ الزُّبَيْرِ وَإِنْ كَانَ ثَلَاثَ عَشْرَةَ أَوْ خَمْسَ عَشْرَةَ فَإِلَى أَقَلَّ مِنْ ذَلِكَ وَاللهُ أَعْلَمُ وَاخْتَلَفُوا فِي سِنِّ عَلِيٍّ ؓ يَوْمَ قُتِلَ فَقِيلَ خَمْسٌ وَسِتُّونَ سَنَةً وَقِيلَ ثَلَاثٌ وَسِتُّونَ وَقِيلَ أَقَلُّ مِنْ ذَلِكَ وَأَشْهَرُهُ ثَلَاثٌ وَسِتُّونَ عَلَى رَأْسِ أَرْبَعِينَ مِنْ مُهَاجَرِ رَسُولِ اللهِ ﷺ فَيَرْجِعُ سِنُّهُ يَوْمَ أَسْلَمَ عَلَى قَوْلِ مَنْ قَالَ مَكَثَ رَسُولُ اللهِ ﷺ بِمَكَّةَ عَشْرًا إِلَى ثَلَاثَ عَشْرَةَ سَنَةً وَعَلَى قَوْلِ مَنْ قَالَ ثَلَاثَ عَشْرَةَ إِلَى عَشْرِ سِنِينَ فَفِي أَكْثَرِ الرِّوَايَاتِ كَانَ ؓ بَلَغَ مِنَ السِّنِّ حِينَ صَلَّى مَعَ النَّبِيِّ ﷺ قَدْرًا يَحْتَمِلُ أَنْ يَكُونَ احْتَلَمَ فِيهِ وَمَا رُوِيَ مِنَ الشِّعْرِ مُحْتَمِلٌ لِلتَّأْوِيلِ مَعَ ضَعْفِ إِسْنَادِهِ عَلَى أَنَّ الْحُكْمَ بِصِحَّةِ قَوْلِ الْبِالِغِ دُونَ الصَّبِيِّ الْمُمَيِّزِ وَقَعَ شِرْعَةً بَعْدَ إِسْلَامِ عَلِيٍّ ؓ فَإِسْلَامُهُ كَانَ مَحْكُومًا بِصِحَّتِهِ إِمَّا لِأَنَّهُ بَقِيَ حَتَّى وَصَفَ الْإِسْلَامَ بَعْدَ بُلُوِغِهِ أَوْ لِأَنَّ النَّبِيَّ ﷺ خَاطَبَهُ بِالدُّعَاءِ إِلَى الْإِسْلَامِ وَغَيْرُهُ مِنَ الصِّبْيَانِ غَيْرُ مُخَاطَبٍ أَوْ لِأَنَّ قَوْلَ الصَّبِيِّ الْمُمَيِّزِ إِذْ ذَاكَ كَانَ مَحْكُومًا بِصِحَّتِهِ قَبْلَ وُرُودِ الشَّرْعِ بِغَيْرِهِ أَوْ كَانَ قَدِ احْتَلَمَ فَصَارَ بَالِغًا بِهِ وَاللهُ أَعْلَمُ هَذَا وَقَدْ ذَهَبَ الْحَسَنُ الْبَصْرِيُّ وَغَيْرُ وَاحِدٍ فِي رِوَايَةِ قَتَادَةَ إِلَى أَنَّ عَلِيًّا ؓ أَسْلَمَ وَهُوَ ابْنُ خَمْسَ عَشْرَةَ سَنَةً أَوْ سِتَّ عَشْرَةَ سَنَةً كَمَا مَضَى ذِكْرُهُ