A mihrab is usually a niche set into the middle of the qibla wall of a building in order to indicate the direction of Mecca. The earliest mosques do not appear to have had mihrabs and instead the whole qibla wall was used to indicate the direction of Mecca. Sometimes a painted mark or a tree stump would be used to reinforce the direction. In the cave beneath the rock in the Dome of the Rock there is a marble plaque with a blind niche carved into it which, if contemporary with the rest of the structure, may be dated to 692 making if the oldest surviving mihrab. The first concave mihrab appears to have been inserted into the Prophet's Mosque at Medina during some restorations carried out by the Umayyad caliph al-Walid I in 706. Excavations at Wasit in Iraq have confirmed this date for the introduction of the first concave mihrab where there are two superimposed mosques: the lower one datable to the seventh century has no mihrab whilst the upper mosque has a concave mihrab.
In addition to its function as a directional indicator it is thought that the first mihrab niches had a ceremonial or ritual function associated with symbols of royalty. Certainly the mihrab became a focus for architectural decoration and was often embellished with the latest artistic techniques (e.g. stucco, polychrome glazed tiles, carved woodwork, glass mosaic, marble inlay). The designs were usually epigraphic and often geometric or vegetal, but never with any suggestion of figurative imagery. The area in front of the mihrab was also emphasized, either by a maqsura immediately in front of the mihrab or a raised aisle leading from the courtyard to the niche. In later mosques, especially in Bengal, multiple mihrabs are set into the qibla wall, thus diffusing any hierarchy of sanctity.
There is also an early association of mihrab and minbar, with the minbar placed next to the mihrab possibly to lend spiritual authority to the sermon. In some areas such as East Africa the mihrab is linked to a recessed minbar niche so that the imam climbs the minbar by entering a door in the side of the mihrab. This arrangement, however, is extremely unusual as the mihrab should be kept free of any mystical connotations.