Ultimately, as is the case for all rightful authority, it originates with God. From there, however, authority is distributed by law from, to and through various offices for various purposes. That is what the rule of law means.
A king does not rule simply by virtue of his birth. He rules because...