Abdul-Aziz ibn Marwan (father of Umar ibn Abdul-Aziz) was designated as the next Khaleefah (wali ul-Ahd) after Abdul-Malik but he passed away before Abdul-Malik, so that allowed a new succession contract to be created. Abdul-Malik designated his son Al-Walid as the first successor and Sulayman as the successor after him.
When Abdul-Malik died, his son Al-Walid became the Khaleefah and was given the bay’a by the Ahlul hali wal-aqd in Ash-Sham. Under his rule the Khilafah reached its highpoint in terms of conquests, with Spain, Sindh and Central Asia all becoming part of the state.
In 95H/714CE, Al-Walid attempted to change the succession contract (wiliyat ul-ahd) his father Marwan had instituted, by removing his brother Sulayman as the next Khaleefah after him. Al-Walid wanted his son Abdul-Aziz to be the next Khaleefah instead of Sulayman. As discussed, designating two or more successors as part of the wiliyat ul-ahd, which was Marwan’s ijtihad, was considered valid by the ulema and Ahlul hali wal-aqd, and so represents a shubhat daleel (semblance of an evidence). Mawardi mentions that this was acted upon throughout the Umayyad and Abbasid periods and the ulema of the time consented to this.
In terms of Al-Walid’s attempts to alter the wiliyat ul-ahd then there is ikhtilaaf (difference of opinion) among the ulema on whether this is permitted or not. Mawardi says, “If the Khaleefah dies while the three to whom he has designated succession are still alive and the Khilafah falls to the first of them and he wishes to pledge succession to someone other than the two whom the previous Khaleefah had chosen for succession, then there are some fuqaha who forbid it basing their judgement on the order of succession stipulated (by the previous Khaleefah)- except if they forgo their right to it voluntarily.
As-Safah (first Abbasid Khaleefah) pledged succession to al-Mansur, may Allah be pleased with them both, and then to Isa ibn Musa second in line after him; then al-Mansur wanted to give preference to al-Mahdi over Isa and wanted the latter to renounce his right of succession and to refrain from making any claim to it; numerous fuqaha of the time, however, did not consider he was justified in depriving him against his will of his inheritance of the succession but rather to seek to induce him with gentleness to step down of his own free will.”
Al-Mansur, the second Abbasid Khaleefah succeeded in changing the wiliyat ul-ahd and replaced his nephew Isa ibn Musa with his son Al-Mahdi. Even though the Abbasids overthrew the Umayyads and took over the Khilafah, they continued to implement the same adopted sharia rules regarding the bay’a. Mawardi then goes on to explain the Shafi’i opinion which permits what Al-Walid was attempting.
He says, “What is most evident within the school of ash-Shafi’i, may Allah have mercy on him, and amongst the majority of the fuqaha is that it is permitted for the one who becomes Khaleefah from amongst the designated successors to designate the next successor from amongst whomever he pleases and to remove any right of succession from those following after him in line since this line of succession is restricted to those who have a claim to the Khilafah after the death of the one who has named them. Thus if the Khilafah falls to one of them, in accordance with the designated order, it is this person who is most entitled to designate succession as he pleases since overall authority for the execution of the responsibilities of this office became his when the Khilafah fell to him: thus his right is the strongest and his capacity to pledge succession takes precedence.”
The Shafi’i position is that since all executive power is with the Khaleefah then he is permitted to change the designated successors. It should be noted that in Al-Walid’s time this was not the prevalent opinion, and so the ulema and Ahlul hali wal-aqd adopted that it was forbidden to change the designated successors, unless the successors voluntarily agreed to it. This follows the laws of contract in Islam where they must be based on free choice and consent.
Initially Al-Walid tried to persuade Sulayman to allow his son Abdul-Aziz ibn Al-Walid to become the next Khaleefah, and then Sulayman would be Khaleefah after Abdul-Aziz, but Sulayman refused. Then Al-Walid offered large sums of money to Sulayman if he would renounce his place, but again Sulayman refused. Al-Walid then wrote to his governors ordering them to take the bay’a for his son Abdul-Aziz instead of Sulayman, but they all refused to obey his order except al-Hajjaj, the infamous governor of Iraq and Qutaybah ibn Muslim, the governor of Khorasan. This shows that while the Khaleefah has full executive powers in Islam, he is bound by the sharia (legislative branch) and so are all his deputies. The Prophet ﷺ said, “It is a duty upon a Muslim to listen and obey (the ruler), whether he likes it or not, unless they command sinful disobedience. If they command sinful disobedience, then there is no listening or obedience to them.”
Umar ibn Abdul-Aziz was one of the advisors to Al-Walid ibn Abdul-Malik and accounted him on his attempts to alter the wiliyat ul-ahd saying, “O Amir al-Mu’mineen! If we pledge allegiance to both of you in a single covenant, then how can we renounce him and leave you?” Al-Walid was outraged by Umar’s comments and it is said that he attempted to deal with him harshly as a means of getting him to agree to do what he wanted. It has been stated that he locked him in a room and sealed the door shut until Umm al-Banin, Umar’s sister and the wife of Al-Walid requested to enter. As a result, the door was opened after three (days or weeks) by which time Umar’s face had become withdrawn and his neck had become bent.
Umar ibn Abdul-Aziz’s stance in opposing the deposition of Sulayman was mentioned by adh-Dhahabi as one of the reasons Sulayman nominated Umar as the Khaleefah after him. “Because of that, Sulayman was grateful to Umar and nominated him as his successor to the Khilafah.”
All of Al-Walid’s attempts to change the next Khaleefah to his son failed. So after his death Sulayman ibn Abdul-Malik was given the bay’a in 96H/715CE. Since there was no third successor, this allowed Sulayman to create his own succession contract and he designated his nephew Umar ibn Abdul-Aziz as the next Khaleefah, and then his brother Yazid ibn Abdul-Malik after him.
 Tabari places this event under 96H but al-Hajjaj died in Ramadan/Shawwal 95H, 8 months before Al-Walid died so it had to take place in 95H.
 Abu l-Hasan al-Mawardi, The Laws of Islamic Governance, translation of Al-Ahkam as-Sultaniyah, Ta Ha Publishers, pp.23
 Ibid, pp.24
 Ibid, pp.25
 Abu Ja`far Muhammad b. Jarir al-Tabari, ‘The History of Al-Tabari’, translation of Ta’rikh al-rusul wa’l-muluk, State University of New York Press, Volume XXIII, pp.222
 Siyar A ‘lam an-Nubala’ [The Lives of Noble Figures] (5/148-9); Athar al-‘Ulama’ fil-Hayat as-Siyasiyyah [The Influence of Scholars in Political Life], pp. 167
 Siyar A ‘lam an-Nubalii’ [The Lives of Noble Figures] (5/149)