Pre-colonial Makhzen

The Pre-colonial Makhzen (المخزن) was the governing institution of pre-colonial Morocco prior to the imposition of the French protectorate as a result of the Treaty of Fes in 1912. The form of government in Morocco was an absolute monarchy, and all political sovereignty belonged to the Sultan of Morocco. The Makhzen governed on the basis of Shari'a Islamic law derived from the Qur'an. The Makhzen operated on a system of Sharifism, in which the shurafā, descendants of Muhammad through his grandson Hasan ibn Ali, held a privileged political and religious position in society. Bilād al-Makhzen ('the land of the makhzen') was the term for the areas under central government authority, while those areas run by autonomous tribal authority were known as Bilād as-Siba ('the land of dissidence').

Etymology
The word makhzen (مخزن), meaning "warehouse" in Arabic (from khazana 'to store up'. )

Administration
The Empire of Morocco was divided into provinces, and these were divided into districts. Provinces were governed by a qāḍī, while districts were governed by sheikhs. The qāḍīs were appointed by the sultan in the Moroccan capital of Fes. Each village was governed by a muqaddam, who was responsible for order among the governed civilians. Governors were appointed from the most influential people of their tribe or district. Their duty was to levy taxes for the imperial treasury and to maintain order, and could punish by fine, imprisonment or foot whipping. Only the sultan of Morocco had the right to give the direct order of capital punishment. Most of these governors, in addition to the police force, were unpaid officials. It was only until the recommendations and advice of Sir John Drummond Hay during the reign of Sultan Muhammad IV bin Abd al-Rahman (1859-1873) that the plan of paying administrators was introduced, following the Anglo-Moroccan Treaty of 1856, to the great advantage of the treasury. However, great fraud and irregularities remained.

Tribal loyalties
State power was based on a system of personal loyalty to the sultan, which was exchanged for protection. State authority extended to Arab tribes and Berber tribes that pledged allegiance to the Sultan. Pre-colonial Morocco in the eighteenth and nineteenth centuries had no clear state boundaries nor clear temporal subjects. There were tribes that refused the sultan's authority and taxes, in areas known as Bilād as-Siba, lawless areas outside the control of the Moroccan sultans. Increasing taxes were often resisted by semi-autonomous tribes and towns, causing rebellions. Arab tribes provided a significant force to the sultan's army. They were known as the Guich, Arab tribes that served as troops and military garrisons, as well as to protect the outskirts of the capital and to suppress rebellions.

Sharifism
The Saadi dynasty revived Sharifism in the 16th century to assert Arab supremacy in Berber regions. The 'Alawite dynasty rose to power in the 17th century through its Sharifian lineage as well as its alliances with shurafā' families in Fes, especially the Idrisid family, descendants of the founder of Fes, Idris II. Beginning during the reign of Sultan Ismail (1672-1727), the Makhzen began to officially document and verify lineages, restricting the number of families that could receive tax cuts and other benefits on the basis of their sharīfī lineage.