Islam does not have an ordained clergy with authority over rites and rituals. Any Muslim with sufficient knowledge may lead prayers or perform rituals such as weddings or funerals. In the early years of Islam, learned members of the mosque led the prayers and gave the Friday sermon. They were called imams—literally, those who stand in front. They also taught the basics of Quran and family law, and led the prayers at weddings and funerals. In some places, this job is still done without stipend and shared by several members of the mosque congregation, but in the larger mosques, a full-time imam performs all these duties, and in addition administers schools and Islamic centers, visits the sick, and helps engaged couples prepare for their weddings.
Learned men were engaged in Quranic interpretation and legal discussions from the earliest days of the community in Medina. By the 9th century, a professional class of religious scholars had emerged, known as the ulama (singular, alim), or "people of knowledge." (Imam is used synonymously with alim.) As a distinct social class, the ulama were defined by their roles as scholars and teachers of the Quran, shariah, jurisprudence, family law, and theology (kalaam). The ulama controlled the schools (madrasahs) and courts, which allowed them to exercise profound influence over society both in their own times and in future generations. The ulama today lead the religious life of the Islamic community (ummah). They have a variety of different duties and specializations, but together they share the responsibility of maintaining continuity in the spiritual and intellectual life of the ummah.
In the last two centuries, the influence of the ulama has declined in most parts of the world primarily because majority Muslim countries are oppressive dictatorships and only allow for state-appointed ulama. Muslims in western lands are just beginning the process of creating seminaries for training male and female imams. As such their local and national religious leaders most often tend to be the most popular male and female preachers who have distinguished themselves by their culturally contextualized knowledge of Islam and their public display of piety.
The ulama grew powerful during the Abbasid caliphate (750-1258 C.E.). The Abbasid caliphs supported the scholars while relying on them to legitimate their rule. As a result, early versions of Islamic political thought tended to sanction existing regimes and discourage armed rebellion against the state. Yet the ulama sometimes served as advocates for popular grievances, and held that their status and piety as scholars derived from maintaining their independence from the state. This established a pattern for relationships between ulama and governments that continued for much of Islamic history. In the modern period, however, many Muslim governments have been relatively more successful compared to the pre-modern states in incorporating the ulama into the structure of the state.
The Sufis, Islamic mystics who seek inner knowledge of God, and the ulama at times enjoyed a mutual relationship. The ulama were known as the ulama al-zahir, or "scholars of the exoteric," specializing in formal knowledge acquired through intellectual effort. The Sufis were known as the ulama al-batin, or "scholars of the esoteric," specializing in inner knowledge acquired through the efforts of the heart. Theoretical Sufism was taught in the madrasahs, and Sufis acknowledged the legal authority of the ulama. Many ulama even chose to affiliate with a Sufi order in addition to an affiliation with a legal school. Those who combined formal scholarship with Sufism were called dhu al-janahayn, or "one who possesses two wings."
Although the ulama were primarily defined by their knowledge and erudition, they also performed a number of practical duties on behalf of the community. This is still the case in contemporary Islamic life. The various titles held by ulama relate to their practical functions, some of which are familiar to non-Muslim westerners. For example, a mullah is a learned man who has studied Islamic jurisprudence, and advocates for traditional interpretations. Mullahs teach in the madrasahs. A mufti is a scholar who interprets Islamic familial law, and issues legal opinions called fatwa in order to provide guidance to Muslims in new situations. In a practice dating to the Ottoman Empire, some governments in Sunni-majority countries appoint a senior mufti to the position of Grand Mufti.