Sovereignty belongs to God. The ruler, whether a king or an elected or nominated representative, can only rule as His vicegerent and in accordance with His laws.
وَالَّذِينَ اسْتَجَابُوا لِرَبِّهِمْ وَأَقَامُوا الصَّلَاةَ وَأَمْرُهُمْ شُورَىٰ بَيْنَهُمْ وَمِمَّا رَزَقْنَاهُمْ يُنْفِقُونَ
And those who respond to their Lord and keep up prayer, and their rule is to take counsel among themselves, and who spend out of what We have given them. (42:38)
الَّذِينَ إِنْ مَكَّنَّاهُمْ فِي الْأَرْضِ أَقَامُوا الصَّلَاةَ وَآتَوُا الزَّكَاةَ وَأَمَرُوا بِالْمَعْرُوفِ وَنَهَوْا عَنِ الْمُنْكَرِ ۗ وَلِلَّهِ عَاقِبَةُ الْأُمُورِ
Those who, should We establish them in the land, will keep up prayer and pay the poor-rate and enjoin good and forbid evil; and Allah's is the end of affairs. (22:41)
When Imaam ‘Ali (as) was finally elected the khalifah he endeavored to establish an Islamic government but alas he was not permitted to rule for long.
However, during the five years of ‘Ali's reign he wrote several letters to his Governors and Commanders restating the principles of governance in Islam. These letters and instructions have been compiled into a book called `Nahjul Balagah', English translations of which are available.
The most famous of these documents is ‘Ali's letter to his Governor in Egypt, Maalik Ashtar, which deals with a variety of subjects including administration, judiciary, treatment of non-muslims, the army and the conduct of a ruler or his representative. In the preamble of the letter ‘Ali says:
“This is what Allah's servant ‘Ali (as) has ordered Malik ibn al-Harith al-Ashtar when he appointed him Governor of Egypt, for the collection of its (Egypt's) revenues, fighting against its enemies, seeking the good of its people and making its cities prosperous.”