When people elect a government their election would be an...
When people elect a government their election would be an authorization of the government to represent them. Whatever it legislates of regulations which restrict the freedom of the people would be by their authorization and consent. The government in fact would be the people themselves because it represents them and fulfills their wish.
This means that the individuals who elected their government are the ones who restricted their own freedom and gave up some of their natural rights by their own will. As man has the right to restrict his own freedom the Creator has the right to restrict the freedom of His human creatures because the Creator is the giver of that freedom. Therefore He has the right to curtail it as He chooses.
Because the Creator has the right to restrict the freedom of His human creatures He sent Messengers to communicate to His servants His commandments and prohibitions and the rest of His laws. These laws restrict their freedom by commanding them to do what they do not like to do and to avoid many of the things which they do not like to avoid.
As the Creator of the individuals and the communities has the right to restrict their freedom He has the right to choose for them rulers to enforce the Heavenly law which the Almightly revealed to His Messenger. If God chooses for His servants a ruler His choice would be binding on them. They have no right to choose for themselves other than what He chose for them. His choice for them is better than their choice for themselves.
When they choose for themselves they give up some of their freedom by their own consent but they do not insure for themselves what is good for them. They do not know with certainty the best man to rule them and they cannot foresee their future or the future of the ruler whom they choose. On the other hand God foresees their future as He sees their present and past. The reader may think that the establishment of a government by God's appointment is a mere hypothesis which has no existence.
What is available to peoples and nations is only man-made governments and their best kind is a government through a populous election. This is true at the present. But the establishment of a government by Divine selection was possible and feasible at the time of the Holy Messenger Muhammad. He himself was a ruler by Divine selection.