A zawiya (Arabic) is a Sufi lodge, a building also known as a khanqah among Persian-speaking Sufis, and a tekke in the Turkish-speaking world. Sufism began to be formalized into particular tariqas or orders in the Middle Ages. Sometimes using funds from private patrons, or through the donations of their disciples, Sufi teachers began to build lodges in which they, as master of the order, and their disciples and students could live. Often a lodge would grow up around the tomb of a Sufi master. A shrine erected over the tomb of a venerated person is called a dargah.
Occasionally, temporary lodging or hospices became attached to lodges to accommodate travelers. Lodges soon became institutions of learning and around them other colleges or madrasas could grow, in which students could acquire training in Islamic law, theology, philosophy, and natural sciences in addition to their spiritual training. Thus the Sufi lodge is a place for spiritual retreat and development. Those lodges whose pedagogical function was linked to a defensive function in military enclosures called ribat were also a feature of medieval Sufism.
While it is not known when the first Sufi lodge was built, another kind of Sufi residence, an fortified building or fortress called a ribat was in use as a retreat for Sufi brotherhoods in the early Islamic period, probably as early as the 9th century C.E.
In addition to serving as a residence, a zawiya is the space in which particular ceremonies or rituals are performed. Daily gathering for communal recitation of prayer and supplication, beyond the daily prayers incumbent on all Muslims, is an important aspect of Sufi practice. Since men and women are in separate orders, sessions such as these are also single-sex practices. The zawiya could be a physical space of retreat in which disciples perform dhikr (invocation, remembrance) or sama' (a spiritual concert, or recitation of songs or poetry, sometimes accompanied by ritual dancing).
In Cairo, Egypt, the tomb and khanqah of Baybars II dates to the early 14th century C.E., and once housed several hundred Sufis. It is the oldest such complex in Cairo. The main building, which is heavily adorned, served multiple functions. Part mosque, part school, and part residential complex, it features decorative elements common in late medieval Islamic architecture, including the muqarnas decoration, a type of complicated and multilayered vaulting that gives the impression of a beehive pattern carved into the stone. Elsewhere in Egypt, the city of Tanta is an important center for the Badawi order of Sufis, named for its founder Ahmad al-Badawi, who was originally an Iraqi whose following grew in Egypt.
Like the complex founded by Baybars II, a central lodge could elevate the spiritual status or a town or city in the Islamic world. John Renard categorizes Muslim holy sites as global/universal or local/regional. Shrines to biblical patriarchs, such as the tomb associated with Abraham in Hebron in the vicinity of Jerusalem, sacralize a landscape beyond the major pilgrimage cities of Mecca and Medina. In Morocco, Idris, said to be a descendant of Muhammad and the founder of Moroccan Sufism, founded the holy city of Fez. Shi'i saints' shrines in Qum and in Iraqi cities like Najaf continue to serve as major pilgrimage sites.
In South and Southeast Asia, many major shrines to Sufi masters, such as those of the Chishtiya order, dot a landscape in which Sufism and Hinduism have intermingled for centuries. All of these sites serve as pilgrimage sites for visitors seeking the blessing, or baraka associated with a holy site. Central to the concept of the baraka of a sacred space is that the saint's presence may actually be felt more strongly the closer one gets to a holy site.
The city of Touba in Senegal was founded in 1887 as a holy site by Shaykh Amadou Bamba (1853-1927) after a vision. Completed in 1963, the Great Mosque of the city-shrine is founded on his burial site, and today Touba is one of the larger metropolitan areas of the country.