Sharia (or Islamic law), the primary source of law in modern Saudi Arabia, was developed gradually by Muslim judges and scholars between the seventh and tenth centuries. From the time of the Abbasid caliphate in the 8th century, the developing Sharia was accepted as the basis of law in the towns of the Muslim world, including the Arabian peninsula, and upheld by local rulers, eclipsing urf (or pre-Islamic local customary law). In the rural areas, urf continued to be predominant for some time, and, for instance, was the main source of law among the bedouin of Nejd in central Arabia until the early 20th century.
By the 11th century, the Muslim world had developed four major Sunni schools of Islamic jurisprudence (or fiqh), each with its own interpretations of Sharia: Hanbali, Maliki, Shafi and Hanafi. In Arabia, a preference for the Hanbali school was advocated by the Wahhabi movement, founded in the 18th century. Wahhabism, a strict form of Sunni Islam, was supported by the Saudi royal family (the Al Saud) and is now dominant in Saudi Arabia. From the 18th century, the Hanbali school therefore predominated in Nejd and central Arabia, the heartland of Wahhabi Islam. In the more cosmopolitan Hejaz, in the west of the peninsula, both the Hanafi and Shafi schools were followed.
Similarly, different court systems existed. In Nejd, there was a simple system of single judges for each of the major towns. The judge was appointed by the local governor, with whom he worked closely to dispose of cases. In the Hejaz, there was a more sophisticated system, with courts comprising panels of judges. In 1925, Abdul Aziz Al Saud of Nejd conquered the Hejaz and united it with his existing territories to form the Kingdom of Saudi Arabia in 1932. In 1927, the king introduced a new court system to the Hejaz comprising general and summary courts and ordered that Hanbali fiqh should be used. However, Nejd's traditional system of judges was left in place in the face of conservative opposition from the Nejd religious establishment.
After becoming familiar with the Hejaz court system in the following decades, the religious establishment allowed its introduction to the rest of the country between 1957 and 1960. Additionally, from the 1930s, Abdul Aziz created government tribunals or "committees" to adjudicate in areas covered by royal decrees such as commercial or labor law. The system of Sharia courts and government tribunals created by Abdul Aziz largely remained in place until the 2007 judiciary reforms (see below). Until 1970, the judiciary was the responsibility of the Grand Mufti, the country's most senior religious authority. When the incumbent Grand Mufti died in 1969, however, the then king, Faisal decided not to appoint a successor and took the opportunity to transfer responsibility to the newly established Ministry of Justice.
The Shia community of the Eastern province have a separate legal tradition. Although they follow Sharia, they apply the Shia Jafari school of jurisprudence to it. In 1913, when Abdul Aziz conquered the area, he granted the Shias a separate judiciary for dealing with religious and family law cases: one judge in Qatif, and one in Al-Hasa. This remained the position, with the two judges ministering to a population of around two million, until 2005 when the number of judges was increased to seven. For all other areas of law, the Shia community are under the jurisdiction of the regular Sunni courts.