عَنِ ابْنِ مَسْعُودٍ رَضِيَ اللَّهُ عَنْهُ قَالَ: قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَآلِهِ وَسَلَّمَ: ((لَا حَسَدَ إِلَّا فِي اثْنَتَيْنِ، رَجُلٌ آتَاهُ اللَّهُ مَالًا فَسَلَّطَهُ عَلَى هَلَاكَتِهِ فِي الْحَقِّ، وَرَجُلٌ آتَاهُ اللَّهُ حِكْمَةً فَهُوَ يَقْضِي بِهَا وَيُعَلِّمُهَا النَّاسَ))
It is narrated from Sayyiduna Abdullah bin Mas’ud (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) said: “Envy is permitted only in two cases: one, a man whom Allah has given wealth and enabled him to spend it in the cause of truth; and the other, a man to whom Allah has given wisdom (i.e., beneficial knowledge), and he judges by it and teaches it to the people.”