Although in theory any Yemeni at the time of the imam can become a Qadi through the study of Islamic law, in practice this privileged status was hereditary. Most Qadis were drawn from urban families that had no particular tribal allegiance, and most of them were Zaydis, but a few Sunni Shafi‘i Qadis were appointed as well.