During the central decades of the 18th century, Tunisia, then part of the Ottoman Empire, witnessed an unprecedented intensification of the relationship between the Ḥusaynid rulers and the ʿulamāʾ. Madrasas were founded and built – doubling their number in Tunis alone – and members of the ruling dynasty married into scholarly families. The main protagonists of this development were ʿAlī b. Muḥammad, more commonly known as ʿAlī Pasha (r. 1735-1756), and ʿAlī b. Ḥusayn (r. 1759-1777). These two rulers did not limit themselves to acts of patronage for scholars, however, but also wanted to be perceived by their subjects – and presented by their panegyrists – as active participants in the scholarly life of the period. This strategy of political representation, which so far seems to have escaped the attention of researchers, is reflected both in contemporary historiographical works, e.g. Ḥammūdah b. ʿAbd al-ʿAzīz’s al-Kitāb al-Bāshī, and in panegyric poetry, e.g. by ʿAlī al-Ghurāb. It appears to have had no precedents in the history of Ottoman Tunisia and was abandoned after the death of ʿAlī b. Ḥusayn. All this begs the question: What might have prompted the rulers of Tunisia to intensify their relationship with the ʿulamāʾ to such an unprecedented degree at this particular historical moment? I propose that the answer mainly lies in a long-term process in the history of Ottoman Tunisia that saw the central government continuously increase its control over the rural and peripheral areas of the regency. This process, which reached a high point in the 18th century, would have been accompanied by a growing demand for legal and administrative specialists, which in turn could explain the attention lavished on scholars and educational institutions. Tunisia’s scholar princes and their intensive patronage of the ʿulamāʾ therefore are an important – but so far overlooked – chapter in the story of the profound social and political changes that transformed the Maghrib in the Ottoman period.