How the caliph of the Muslims is appointed
Question

                How did the Islamic state organize its affairs? How did the government rule in the earliest period?.
Praise be to Allah.
    The Muslim ruler must appoint people who are qualified to 
    hold positions of high office in the state, and he must also hold 
    consultations with people of knowledge and those who are specialized in 
    various fields. That should not be left to the common folk or the masses for 
    everyone to elect his relative or a member of his party, or to elect the one 
    who will pay the most. 

    Shaykh Saalih ibn Fawzaan (may Allaah preserve him) said: 

    Official positions that are lower than that of caliph or 
    ruler: Appointing people to these positions was the job of the caliph or 
    ruler. He had the authority to select for them people who were competent and 
    had integrity. Allaah says (interpretation of the meaning): “Verily, 
    Allaah commands that you should render back the trusts to those, to whom 
    they are due; and that when you judge between men, you judge with justice” 
    [al-Nisa’ 4:58]. This is addressed to rulers and those in authority. 
    Trusts (amaanaat) here refers to official positions and positions of 
    high office in the state, which Allaah made a trust that is entrusted to the 
    ruler. The way in which it is to be fulfilled is by choosing people who are 
    competent and have integrity, as the Prophet  (peace and blessings of 
    Allaah be upon him) and the caliphs who came after him and the Muslim rulers 
    after them appointed to various positions those who were fit to hold those 
    positions and were able to fulfil these duties as prescribed in sharee’ah. 

    With regard to elections as they are known today in different 
    states, they are not part of the Islamic system and they may lead to 
    disorder and chaos and personal ambitions. They are subject to favouritism 
    and greed, and may lead to fitnah (tribulation) and bloodshed. They do not 
    achieve the purpose they are meant to achieve; rather they are more like 
    auctions, buying and selling, and false propaganda. End quote. 

    Al-Jazeerah newspaper, issue no. 
    11358. 

    The imam (ruler) or caliph was appointed to lead the Islamic 
    state by one of three methods: 

    1-

    He was chosen and elected by the decision makers (ahl al-hall 
    wa’l-‘aqd). For example, Abu Bakr al-Siddeeq became caliph when he was 
    elected by the decision makers, then the Sahaabah unanimously agreed with 
    that and swore allegiance to him, and accepted him as caliph. 

    ‘Uthmaan ibn ‘Affaan (may Allaah be pleased with him) became 
    caliph in a similar manner, when ‘Umar ibn al-Khattaab (may Allaah be 
    pleased with him) delegated the appointment of the caliph to come after him 
    to a shoora council of six of the senior Sahaabah, who were to elect one of 
    their number. ‘Abd al-Rahmaan ibn ‘Awf consulted the Muhaajireen and Ansaar, 
    and when he saw that the people were all inclined towards ‘Uthmaan, he swore 
    allegiance to him first, then the rest of the six swore allegiance to him, 
    followed by the Muhaajireen and Ansaar, so he was elected as caliph by the 
    decision makers. 

    ‘Ali ibn Abi Taalib (may Allaah be pleased with him) became 
    caliph in a similar manner, when he was elected by most of the decision 
    makers. 

    2-

    Appointment to the position by the previous caliph, when one 
    caliph passes on the position to a particular person who is to succeed him 
    after he dies. For example, ‘Umar ibn al-Khattaab became caliph when the 
    position was passed on to him by Abu Bakr al-Siddeeq (may Allaah be pleased 
    with him). 

    3-

    By means of force and prevailing over others. When a man 
    becomes caliph by prevailing over the people by the sword, and he 
    establishes his authority and takes full control, then it becomes obligatory 
    to obey him and he becomes the leader of the Muslims. Examples of that 
    include some of the Umayyad and ‘Abbasid caliphs, and those who came after 
    them. This method is contrary to sharee’ah, because it is seized by force. 
    But because great interests are served by having a ruler who rules the 
    ummah, and because a great deal of mischief may result from chaos and loss 
    of security in the land, the one who seizes authority by means of the sword 
    should be obeyed if he seizes power by force but he rules in accordance with 
    the laws of Allaah. 

    Shaykh Muhammad ibn Saalih al-‘Uthaymeen (may Allaah have 
    mercy on him) said: 

    If a man rebels and seizes power, the people must obey him, 
    even if he seizes power by force and without their consent, because he has 
    seized power. 

    The reason for that is that if his rule is contested, it will 
    lead to a great deal of evil, and this is what happened during the Umayyad 
    period when some of them seized power by means of force and gained the title 
    of caliph, and people obeyed them in obedience to the command of Allaah. End 
    quote. 

    Sharh al-‘Aqeedah al-Safaareeniyyah 
    (p. 688). 

    For more information on this topic, and to find out how the 
    state should operate and how its affairs should be run, please see Ahkaam 
    al-Sultaaniyyah by Abu’l-Hasan al-Maawardi al-Shaafa’i and Ahkaam 
    al-Sultaaniyyah by Abu Ya’la al-Farra’ al-Hanbali, and al-Tarteeb 
    al-Idaariyyah by al-Kattaani. 

    And Allaah knows best.