The sixth-century church of Saints Sergius and Bacchus became a mosque with an octagonal central hall.