بِسۡمِ اللّٰہِ الرَّحۡمٰنِ الرَّحِیۡمِ
والصلاة والسلام على خاتم النبيين
وعلى اهل بيته اطيبين الطاهرين
Joseph, son of Jacob عليهما السلام was a Prophet of God. In his prophetic capacity, a Prophet wields supreme (divinely-delegated) authority, and may potentially overrule any human institution if the need arises. But as I have explained on my blog, there have been instances where a Prophet acquired an additional role to his prophesy, namely, the office of political authority which is not a divinely appointed office. This was certainly the case with our Prophet Muhammad صلى الله عليه وسلم as I explained in my inspired thesis.
While in Egypt, Prophet Joseph was appointed by the unbeliever king of that country to the portfolio of treasury minister:
وَ قَالَ الۡمَلِکُ ائۡتُوۡنِیۡ بِہٖۤ اَسۡتَخۡلِصۡہُ لِنَفۡسِیۡ ۚ فَلَمَّا کَلَّمَہٗ قَالَ اِنَّکَ الۡیَوۡمَ لَدَیۡنَا مَکِیۡنٌ اَمِیۡنٌ
قَالَ اجۡعَلۡنِیۡ عَلٰی خَزَآئِنِ الۡاَرۡضِ ۚ اِنِّیۡ حَفِیۡظٌ عَلِیۡمٌ
وَ کَذٰلِکَ مَکَّنَّا لِیُوۡسُفَ فِی الۡاَرۡضِ
And the King said, ‘Bring him to me that I may take him specially for myself.’ And when he had spoken to him, he said, ‘Thou art this day a man of established position and trust with us.’
He said, ‘Appoint me over the treasures of the land, for I am a good keeper, and possessed of knowledge.’
And thus did We establish Joseph in the land
Subsequent to being divinely appointed a Prophet, Joseph was designated treasury minister by the king of Egypt. The Quran also states about Joseph:
مَا کَانَ لِیَاۡخُذَ اَخَاہُ فِیۡ دِیۡنِ الۡمَلِکِ اِلَّاۤ اَنۡ یَّشَآءَ اللّٰہُ
He could not have taken his brother under the King’s law unless Allah had so willed
Despite being a Prophet, Joseph was nonetheless subject to the authority and law of the king of Egypt in his capacity of treasury minister.
In conclusion, political office is entirely separate and distinct from Prophesy. There have been instances where Prophets attained political office, but they maintained the distinction between that political office and their prophetic office.