حَدَّثَنَا عَلِيُّ بْنُ عَبْدِ اللَّهِ حَدَّثَنَا يَحْيَى بْنُ سَعِيدٍ حَدَّثَنَا عُبَيْدُ اللَّهِ قَالَ حَدَّثَنِي سَعِيدُ بْنُ أَبِي سَعِيدٍ عَنْ أَبِيهِ عَنْ أَبِي هُرَيْرَةَ رَضِيَ اللَّهُ عَنْهُ: قِيلَ يَا رَسُولَ اللَّهِ مَنْ أَكْرَمُ النَّاسِ قَالَ أَتْقَاهُمْ فَقَالُوا لَيْسَ عَنْ هَذَا نَسْأَلُكَ قَالَ فَيُوسُفُ نَبِيُّ اللَّهِ ابْنُ نَبِيِّ اللَّهِ ابْنِ نَبِيِّ اللَّهِ ابْنِ خَلِيلِ اللَّهِ قَالُوا لَيْسَ عَنْ هَذَا نَسْأَلُكَ قَالَ فَعَنْ مَعَادِنِ الْعَرَبِ تَسْأَلُونِ خِيَارُهُمْ فِي الْجَاهِلِيَّةِ خِيَارُهُمْ فِي الْإِسْلَامِ إِذَا فَقُهُوا .
It was said, "O Messenger of Allah, who is the most noble among the people?" He (sas) said, "The most pious of them." They said, "This is not what we are asking about." He (sas) said, "Then, Yusuf Allah's prophet, son of Allah's prophet, son of Allah's Prophet, son of Allah's dear friend." They said, "This is not what we are asking about." He (sas) said, "Is it the minerals (stock, family lines) of that Arabs about which you ask? The best (most noble) of you in the Jahiliya is the best of you in Islam when they have understanding (fiqh).
--------------------------------------------
Al-Kareem means one who brings together all good qualities of dignity and good character.
The Prophet's (sas) first answer and the truest and most important was;
يَا أَيُّهَا النَّاسُ إِنَّا خَلَقْنَاكُمْ مِنْ ذَكَرٍ وَأُنْثَى وَجَعَلْنَاكُمْ شُعُوبًا وَقَبَائِلَ لِتَعَارَفُوا إِنَّ أَكْرَمَكُمْ عِنْدَ اللَّهِ أَتْقَاكُمْ إِنَّ اللَّهَ عَلِيمٌ خَبِيرٌ (13) قَالَتِ الْأَعْرَابُ آمَنَّا قُلْ لَمْ تُؤْمِنُوا وَلَكِنْ قُولُوا أَسْلَمْنَا وَلَمَّا يَدْخُلِ الْإِيمَانُ فِي قُلُوبِكُمْ وَإِنْ تُطِيعُوا اللَّهَ وَرَسُولَهُ لَا يَلِتْكُمْ مِنْ أَعْمَالِكُمْ شَيْئًا إِنَّ اللَّهَ غَفُورٌ رَحِيمٌ (14) إِنَّمَا الْمُؤْمِنُونَ الَّذِينَ آمَنُوا بِاللَّهِ وَرَسُولِهِ ثُمَّ لَمْ يَرْتَابُوا وَجَاهَدُوا بِأَمْوَالِهِمْ وَأَنْفُسِهِمْ فِي سَبِيلِ اللَّهِ أُولَئِكَ هُمُ الصَّادِقُونَ (15)
This is the most complete answer and is the definition of akramakum (the most noble of you) from the standpoint of righteous deeds.
His (sas) second answer - Yusuf - is the most noble of mankind from the standpoint of descendency or family lines (perhaps getting "closer" to what the questioner was after).
They were actually asking about the "minerals" of the Arabs or their various tribes, clans and families with which the people of that time identified and took pride from. From the book Al-Majma: "People vary in their family lines and terms of nobility and lack thereof like the differences between mineral deposits. What distinguishes them in Islam, however, is their acceptance of the message of Allah to them upon different levels of knowledge and wisdom or their lack of acceptance thereof."
"The best (most noble) of you in the Jahiliya is the best of you in Islam when they have understanding (fiqh)." There are some who were upon "nobility" and the best aspects of good character - in spite of ignorance of Allah and His commands - in their jahiliya - while others were not and were upon lowly character such as thievery, promiscuity, lying and cheating, inhospitality, miserliness, etc. This yields different possible outcomes:
Those who were upon nobility and good character before Islam and continued in the same manner in Islam. Of those, those, the best are those who attain "fiqh" - knowledge and understanding of Islam.
Those who were upon evil and bad character before Islam and continue to have bad character in Islam. This is the worst of the possibilities.
Those who were upon evil and bad character before Islam but who attained nobility, good character AND fiqh in Islam. These are higher in station than those who are similar in every way but do not acquire knowledge of the deen.
Those who were of high character and station in the jahiliya, but who become lowly and on bad character in Islam. These are worse off than the previous ones. If they attain knowledge of Islam, they reach a higher station than the one who is on good character, but ignorant of the deen.
From Al-Majma: "The condition 'when they have understanding (fiqh)' means that belief removes the distinctions of jahiliya. One who attains knowledge attains by that the real "family" and so has both the nobility of family and of station. We also understand from this that the 'aalim with character flaws is of a superior status to the one who is noble (of good conduct and character) but inactive and unlearned."
From Muhammad ibn Ali (Ibn Al-Hanafiya) regarding Allah's statement:
هَلْ جَزَاءُ الْإِحْسَانِ إِلَّا الْإِحْسَانُ (60)
"It is a musjala (money given) to the righteous or the sinful."
---------------------------------------------
لِلَّذِينَ أَحْسَنُوا الْحُسْنَى وَزِيَادَةٌ وَلَا يَرْهَقُ وُجُوهَهُمْ قَتَرٌ وَلَا ذِلَّةٌ أُولَئِكَ أَصْحَابُ الْجَنَّةِ هُمْ فِيهَا خَالِدُونَ (26) وَالَّذِينَ كَسَبُوا السَّيِّئَاتِ جَزَاءُ سَيِّئَةٍ بِمِثْلِهَا وَتَرْهَقُهُمْ ذِلَّةٌ مَا لَهُمْ مِنَ اللَّهِ مِنْ عَاصِمٍ كَأَنَّمَا أُغْشِيَتْ وُجُوهُهُمْ قِطَعًا مِنَ اللَّيْلِ مُظْلِمًا أُولَئِكَ أَصْحَابُ النَّارِ هُمْ فِيهَا خَالِدُونَ (27)