Abstract
Early Arabic sources report the existence of giant astronomical devices housed inside buildings which were used for observational and computational purposes. Some of them are known to us, but their chronology and their relationship to other well-oriented devices in the Islamic or even in the Latin milieu are yet to be explored in depth. This paper aims to establish whether the zāwiya Nāṣiriyya in Tamegroute (Tamgrūt, in the Drâa valley) described by al-Asfī (seventeenth to eighteenth century) can be considered as part of this tradition.
Preliminaries
Arabic sources record references to early celestial observations in the Islamic East. These observations were made in observation posts more than in official observatories, which did not emerge in the region until the thirteenth century. 1 Some of these observation posts were set up in the open air, in public, or private locations; others were housed inside buildings and functioned by using the effects of the Sun’s rays.
In the ninth century, privately owned posts, like the one belonging to Ahmad al-Nihawandī, who observed the motion of the sun in Jundishāpūr in Persia in 800, overlapped in time with the early astronomical programme sponsored by al-Ma’mūn in the al-Shammāsiyya quarter in Baghdad and in the outskirts of Damascus, at the Dayr Murrān monastery on Mount Qāsiyūn. Al-Ma’mūn sponsored a programme of observations which does not seem to have been carried out in buildings devoted to this aim, but at a series of sites that were suitable for different kinds of measurement. Nevertheless, as a result of these observations, an official zīj was compiled by Yaḥyà b. Abī Manṣūr (d. c.830) and entitled al-Zīj al-Mumtahan al-Ma’mūnī (The Tested Tables of al-Ma’mūn). Throughout the following centuries, observation posts remain in operation, even after the foundation of the first institutional observatory in Marāgha in thirteenth century.
From the fourteenth century onwards, and especially in the Islamic West (Maghreb), there were local traditions of accurately oriented towers and madrasas (schools), where astronomy is said to have been taught and astronomical observations made.
The aim of our study is to elucidate how the zāwiya 2 Nāṣiriyya (or Naciria) 3 in the Drâa Valley (southern Morocco) can be considered an example of this tradition.
Eastern Islam: observatories and observation posts
The differences between observatories and observation posts have been clearly specified by Professor Sayilı in his comprehensive book The Observatory in Islam. In terms of administration and organization, Islamic observatories had a director and a staff of astronomers and received funding and patronage from a ruler, as well as a programme of work. Generally speaking, their main duty was to compile astronomical tables based upon fresh observations of all the planets.
The first observatory of this kind was at Marāgha. This observatory was founded by Hūlāgū Khān in 1259 and remained in use until 1316, 4 thanks to the support of the awqāf revenues. Nāsir al-Dīn al-Tūsī (d. 1274) was the head of a staff of astronomers composed by Qutb al-Dīn al-Shirāzī (d. 1311), Mu’ayyad al-Dīn al-‘Urdī (d. 1266), and Muḥyī al-Dīn al-Magribī (d. c. 1280), among others. The result of their astronomical observations was the al-Zīj al-Ilkhānī.
In 1420, the ruler and astronomer Ulugh Beg (r. 1394–1449) established an astronomical observatory in Samarkand. He was probably aware of Marāgha, because in his childhood he may well have visited it on a trip from his natal Persia to Erzerum to visit his grandfather Tīmūr. The most outstanding astronomers working in Samarkand were al-Kāshi (d. 1429), Qādīzādeh i-Rūmī (d. 1436−1446), and cAlī al-Qūshjī (d. 1474). In this observatory, the Tables of Ulugh Beg were compiled, a very accurate set of astronomical tables used by Ottoman astronomers to make calendars until 1800.
The third Islamic observatory in operation was the Istanbul Observatory, built in 1575 by Murāt III. In fact, it had a very short life due to a dispute between the Sultan and his head of astronomers Taqī al-Dīn (1525−1585). The Sultan ordered the destruction of the observatory in 1580, 5 years after its foundation. It was the first observatory in the Ottoman Empire and the last before the modern European ones came into existence. In fact, there are remarkable parallels between the Istanbul Observatory and its instruments, built by Taqī al-Dīn, and the contemporary observatory built by Tycho Brahe (d. 1601) and the instruments designed for it.
As for the observation posts, they did not have a specific administrative structure and the programme of work was more limited in scope: primarily, measurements of latitude and observations restricted to the Sun and the Moon. Most of the equipment was the property of the astronomers themselves.
In fact, most of the devices and instruments at the observatories could be considered as observation posts in themselves, especially the large instruments requiring a fixed installation which gave early Islamic astronomy its distinctive personality. This is the case, for instance, of the giant sextants which are described in the sources, and some of which have been discovered during archaeological excavations of the remains. The prototype of these sextants consisted of two basic elements: a small hole in the roof to allow the entry of a ray of the Sun and a sextant of a circle set up in the plane of the meridian circle to perform the measurements (Figures 1 and 2). 5

Ulugh Beg and the Observatory of Samarkand. Commemorative stamp.

Observatory’s remains. (By Alaexis (Own work) (CC-BY-SA-2.5 (http://creativecommons.org/licenses/by-sa/2.5)), via Wikimedia Commons).
This sextant started as al-Khujandī’s personal observation post. At the end of the tenth century, this astronomer had constructed a 60° arc of a radius of 20 m in order to measure the obliquity of the ecliptic in Rayy (near modern Teheran). According to Bīrūnī (d. 1048), to whom we owe the description, this sextant was erected on the meridian and placed between two walls. Al-Khujandī (d. 1000) called it al-Suds al-Fakhrī, the «Fakhrī Sextant», in reference to his patron, the Buyid ruler Fakhr al-Dawla (r. 976–997).
At that time or shortly later, another Buyid ruler, Sharaf al-Dawla (r. 982–989), constructed a similar sextant with a radius of 12.5 m in the garden of his royal palace near the Khattābīn gate. This sextant was housed in a building and used to make solstice and equinox observations. When the observations were made, two official documents were drawn up and signed by al-Qūhī (d. c. 1000), the leader of the astronomers working there, Abū l-Wafā’ al-Buzjānī (d. 998) and al-Ṣāgānī (d. 990), as well as other judges, scientists, and scholars who had assembled for the occasion, among them even a Christian monk. The signatories stated that they had observed the entry of the Sun into the sign of Cancer and testified to the accuracy and excellence of the instrument. Three months later, they also testified to the entry of the Sun into the sign of Libra. The building is referred to as bayt al-rasad, “house of observation,” in the Arabic sources. 6
The most famous instrument of this kind, however, was the huge sextant in Samarkand. It was an enormous 60° arc with a radius of 40 m, aligned along the meridian line, North–South. This fixed instrument was housed in a building, which had a hole in the roof to allow operations using the Sun’s rays at midday.
The astronomer al-Kāshī, who, as we said, played a leading role at the Samarkand observatory, wrote a short treatise on astronomical observational instruments in which he offers a rough description of a Fakhrī sextant. The dimensions given by al-Kāshī indicate an instrument about twice the size of the one described by al-Khujandī. 7 In a letter to his father in Kashān, al-Kāshī, he also makes a confused statement concerning the Fakhrī sextant that contradicts his own remarks in the instrument treatise. This may be a sign that he was writing hurriedly. 8
Between East and West: civil buildings and churches in Europe as instruments
Towards the end of the thirteenth century, the Castilian King Alfonso X the Wise, whose diplomatic embassies and scientific exchange with the astronomers of Hulaghu Khan in Maraga has been strongly suggested, 9 included a treatise on the construction of a “Clock of the Palace of the Hours” in his Libros del saber de astronomia (Books on Astronomy). This book, known in Spanish as the “Libro del Relogio del Palacio de las Horas,” is part of a series of five manuals of construction of time measuring devices. In this case, the device can be considered a sun clock because it uses sunlight to show the time. 10
In Italy, the spread of meridian lines constructed inside religious buildings with astronomical purposes is known as early as the fifteenth century. 11 Churches in Florence, first, and then in Bologna, Rome, and Paris served as centres of astronomical observation and mathematical calculations during the seventeenth and eighteenth centuries. They have holes in the roofs, in the lanterns, or in the walls, and meridian lines engraved in the floor. Most of these lines shared the peculiar feature of fitting perfectly in buildings which had been constructed centuries before (Figure 3). 12

The meridian at San Petronio in Bologna (Courtesy of the Bibliothèque de l’Observatoire de Paris).
Meridian lines are also reported in eighteenth-century Spain, in Aranjuez (1747), El Escorial (1755), and Buen Retiro (1756), all near Madrid.
The similarities of the layout and the operating system between the Islamic sextants and the Christian meridian lines suggest the presence of a link between them. This does not come as a surprise; in the fifteenth and sixteenth century, Europe was well informed of the scientific developments that had been discovered before in Eastern Islam.
Western Islam: mosques as observatories
The Western Islamic region, al-Andalus and the Maghreb, appears to stand apart from the rest of Islam in this regard. In spite of a well-established tradition of astronomical observations, these lands were not home to any sophisticated observatories. However, given that the Muslims made calculations based on observations for religious purposes (e.g. the orientation of the qibla 13 or the establishment of prayer times), it is easy to make a link between astronomical practices and religious buildings. This relationship is actually supported by occasional references in written sources as well as some surviving mosques and related buildings, which is the case of the zāwiya Nāṣiriyya.
In al-Andalus, we have only poor written references 14 to personal observation posts where astronomers or muwaqqits 15 (timekeepers) worked, such as the polymath ‘Abbās b. Firnās (tenth century) in Cordova and the astronomer Jābir b. Aflah (twelfth century) in Seville. In the Maghreb, the references are to towers for the observation of the new moon: a “Star Tower” in Fes in the twelfth century and the tower of the Kutubiyya mosque in Marrakech.
In addition, many mosques have indoor sundials, or other devices used for religious purposes; examples are ‘Uqba b. Nāfi‘’s mosque in Qayrawān and the Qarawiyyin in Fez. Moreover, the faqih (or faqīh, jurist) and muwaqqit Muḥammad b. al-Ḥabbāk (thirteenth century), the designer of the first clepsydra (or water clock) in the Maghreb, in the Qarawiyyin mosque, 16 was commissioned by the Merinid emir Abū Yūsuf to determine the date and time of the foundation of Fes Jadīd, the new capital of the Maghreb. The Great Mosque in the new city was oriented in a similar direction (157°) to the Qarawiyyin (163°). 17 In al-Andalus, in the caliphal city of Madīnat al-Zahrā’, near Cordova, there is a “Patio de los relojes” (the Clock Court) so called because some sundials were found there. All these examples show clearly that astronomers were useful in the mosques but also in the palaces; they helped Muslims to observe their religious duties, and their knowledge of astrology was also essential for good governance (Figure 4). 18

Sundial found in Madīnat al-Zahrā’ (Courtesy of Museo Arqueológico de Córdoba).
Indeed, the orientation of buildings in the Maghreb suggests that in the Almoravid period, astronomers made observations in Marrakech in order to find the qibla. The emir ‘Alī b. Yūsuf (twelfth century) met a good number of astronomers and faqihs in order to determine the qibla as accurately as possible. The medieval sources go to some lengths to explain that the orientation was determined with great accuracy 19 and, in fact, ‘Alī b. Yūsuf’s mosque is an example of exact orientation (even though the medieval values are not as precise as modern parameters). Unfortunately, the mosque was demolished by the Almohads, and the present mosque is a later reconstruction dating from the nineteenth century.
The Kutubiyya, mentioned above, is one of the most important Almohad mosques. Here, too, observations were made, as the mosque was demolished and rebuilt a few years later to “improve” its orientation – even though the second building differs by only 5° compared with the first.
Marrakech is a good example of the circulation of ideas and also of the silence involving scientific matters when related to politics. 20 Medieval treatises established that the Almoravids built mosques towards the east. Then, according to the sources, the Almohads destroyed all the Almoravid mosques and built the Kutubiyya (as well as the other Almohad mosques) towards the south. Finally, archaeology has shown that the Kutubiyya faced Suhayl (that’s Canopus in English), and not due south. 21 However, we do not have any textual evidence of the criteria used to establish Kutubiyya’s qibla (Figure 5).

The Kutubiyya mosque in Marrakech.
Folk astronomy
Both in al-Andalus and the Maghreb, muwaqqits played a key role in the development of folk astronomy, that is, astronomy linked with religious duties. This is also the astronomy that was studied at observation posts in the Maghreb and al-Andalus. Nevertheless, it could sometimes be highly technical. 22
The extant works of some Andalusi authors, like Ibn Ḥabīb’s (d. 852) Kitāb al-nujūm, 23 show what kinds of astronomical knowledge were permissible from an orthodox Islamic perspective. There is also a consolidated tradition of kutub al-anwā’, that is, the genre developed in the Islamic lands as the result of the fusion of the analysis of lunar mansions with the meteorological data of the anwā’ system. The most prominent Andalusi authors were Ibn Fāris al-Munajjim (fl. ca. 982), the author of Mukhtaṣar min al-anwā, Ibn ‘Āṣim (d. 1013), 24 and al-Umawī al-Qurtubī (d. 1205). 25 Their books give some very useful advice for everyday life: the reader can obtain valuable information by following the instructions given on the observation of the Sun, Moon, and the most important stars.
Maghrebi authors gathered knowledge bequeathed to them by their Andalusi scholars and wrote even more sophisticated treatises. Ibn al-Bannā’ (d. 1321) 26 with his Taqyīd, al-Jādirī (d. c. 1416), 27 with his Tanbīh al-anām ‘alà mā yaḥduthu fī ayyām al-‘ām – an adaptation of Ibn al-Bannā’’s text – and al-Sūsī al-Mirgīthī (d. 1679) with his al-Muqni ‘fī ikhtiṣār ‘ilm Abī Miqrā‘, 28 are some of the most representative members of this school. Nonetheless, while these works and these authors provide de facto information on observations in the Maghreb, it is not possible to relate them to any actual observatory (Figure 6).

Al-Sūsī al-Mirgīthī’s scheme for seasons, signs, and lunar mansions.
The case of Safi
In this context, the city of Safi gives a new perspective on the field of observatories and observation posts in Western Islam. Safi 29 was an ancient city on the Atlantic coast of northern Africa (in present-day Morocco). The location is mentioned in Islamic geographical sources, like Yāqūt and al-Idrīsī. 30 Safi was considered the seaport of Marrakech for many years and it also appears in cartographical works, e.g., in al-Mursī’s nautical chart (Figure 7). 31

Al-Mursī’s nautical chart. Tripoli, 1461 (Courtesy of Deniz Müsezi).
A native of the city was the eighteenth-century writer Abū ‘Abd Allāh Muḥammad b. ‘Abd al-‘Azīz b. Muḥammad b. Aḥmad b. Idrīs al-Andalusī al-Asfī, who wrote his Irshād al-sā’il ilà ma‘rifat jihat al-qibla bi-l-dalā’il, a treatise on the orientation of the mosques preserved in the fols. 189–198 in manuscript 1110 of the Bibliothèque Hassaniyya of Rabat, Morocco. The copy, written in clear Maghribi calligraphy, is part of a majmū‘ (miscellanea) that also contains two other treatises by the same author: Risāla fī ‘ilm al-rub‘ (183–188) and Sharḥ rajaz fī manāzil al-qamar (216–229). 32 It is dated 19 shawwāl 1281 (17 March 1865) but the name of the copyist does not appear. 33 This work may serve to compensate for the lack of specific documentation on observation posts noted above.
The Safi mosques
One of the most interesting contributions of al-Asfī is the fact that he speaks about his geographical surroundings, and in fact his analysis of the mosques in the city is very detailed. Al-Asfī gives information on the Great Mosque, and the mosques in the Qaṣba, Dār al-Baḥr (Citadel) and Abū Muḥammad Ṣāliḥ’s ribāṭ (a refuge for the Sufi brotherhood). The modern city bears no trace of any Almohad buildings, because the ancient edifices were destroyed during the Portuguese occupation and in other turbulent periods of the city’s history.
In any case, it is surprising that while some Safi mosques are very well oriented (they point towards the east with a slight northward deviation), others are facing the south.
Al-Asfī’s text in which he explains the orientation of the Safi mosques (fol. 195) is as follows (Figure 9): The miḥrāb
35
of the Great Mosque, here in Asfi, points due south. For those who think that the jiha (general direction) of the qibla is a quarter circle, that is 90 degrees – which is reliably correct – this miḥrāb deviates from the jiha by about fourty
36
degrees and, for that reason, the prayer of someone who does not turn will be invalid, as it is invalid for someone to pray with his back towards the qibla. [195v] For those who think that the direction of the qibla is a half circle – which is incorrect – then this miḥrāb is about 5 degrees inside the jiha and he who faces this way is not outside the jiha. If we consider the samt (azimuth), it is outside the jiha by about 85 degrees. And Afnān’s mosque needs a slight deviation towards the east because its miḥrāb is slightly deviated towards the south. The miḥrābs of Sīdī Abī Muḥammad Ṣāliḥ’s ribāṭ and Dār al-Baḥr’s mosque deviate slightly towards the east, and for that reason he who prays there should turn slightly towards the south. The Highest Oriental Qaṣba’s mosque has the same orientation as the Great Mosque mentioned above and this [mosque], may its years protect it, had also been the Great Mosque known as the ancient [al-‘atīq] and Abū ‘Abd Allāh b. Marzūq – God may give him His grace – preached in it when he was in the city.
For al-Asfī, the general orientation (jiha) should be limited to 90°; he disagrees with those who think that it could be 180°. Moreover, he specifies that the samt (the exact orientation) needs to be more precise. Therefore, worshippers at the Great Mosque or the Qaṣba mosque should deviate slightly from the miḥrāb when they pray. In contrast, Sīdī Abī Muḥammad Ṣāliḥ’s ribāṭ and Dār al-Baḥr’s mosque are fairly well oriented (Figure 8).

The correct jiha and samt of Safi according to al-Asfī (bolded line) and the incorrect samt (dotted line).

First folio of al-Asfī’s Irshād, ms. 1110 BH, Rabat.
The Zāwiya Nāṣiriyya
Al-Asfī claims that the best oriented mosque in the whole region (thagr) is the Zāwiya Nāṣiriyya 37 mosque in Tamegroute. 38 This ksar, located in the Sahara, is considered by al-Asfī as part of the region of Safi. 39 Today, the ksar is in Morocco, but during the Ottoman period, Tamegroute was part of the Constantine Beilik. In it, there is a zāwiya called al-Nāṣiriyya, founded by Muḥammad b. Nāṣir in the seventeenth century. His son, Aḥmad, was his successor and also the sheikh of al-Asfī al-Andalusī. Both Muḥammad and Aḥmad travelled to the Mashreq (Islamic East) several times and there they bought many scientific manuscripts. 40 In fact, the library remains a very important place for researchers. 41 At this time, the Ottoman Empire was expanding and gradually occupied almost all of the Maghreb. Whether there was political control or not, it is clear that the Ottoman influence expanded throughout North Africa. This huge area was by no means isolated: in the Mediterranean zone and in the Atlantic coast, the contact with Catalans, Castilians, British, Dutch, and other Europeans was intensive: from the Crusades to Presidios and Fronteiras, the military and commercial contact was continuous and many European consulates were established. 42 Moreover, the Portuguese ruled Safi in the fifteenth and sixteenth centuries and established a bishopric there. 43
One of Muḥammad’s disciples was the above-mentioned al-Sūsī al-Mirgīthī,
44
a famous muwaqqit who established prayer times in the zāwiya. His students were known as “people of the qibla.” In fact, Nāṣiriyya had everything it needed to qualify as an observatory: a director (al-Sūsī al-Mirgīthī), a staff of astronomers (his disciples), and the funding patronage of a ruler (Muḥammad b. Nāsir and his son, Aḥmad). Did they have a programme of work? The answer may be found in al-Asfī’s text (Figure 10): The miḥrāb of the ribāṭ of the Zāwiya Nāṣiriyya points towards the centre of the qibla’s jiha and it is known because it has the best orientation. Its orientation is attested to our shaykh, the prominent imām, scholar, walī, the devout and intelligent Abū ‘Abd Allāh Sīdī Muḥammad b. ‘Alī al-Hashtukī – may God sanctify his tomb – and the faqīh, counsellor, muwaqqit and geometer, the virtuous shaykh Sīdī ‘Abd Allāh b. Sāsī – may God have mercy on him, on us, on our ancestors and our teachers and our shaykhs with His grace. We have tested this many times and we have found it oriented towards the rise of the equinox, that is, the centre of the qibla’s jiha and the samt deviated only about 2 degrees towards the east. This will be clear to those who wish to test it with the astrolabe.

View of the Zāwiya Nasiriyya in Tamegroute. (Google Earth).
For al-Asfī, this zāwiya is a very good example as it is oriented towards the sunrise at the equinox. He follows a tradition established centuries earlier by other Maliki Maghrebi faqihs (like al-Mattījī and al-Masmūdī). They assert that mosques in the Maghreb should face east, which is quite accurate. However, not all the Maliki Maghrebi faqihs were of the same opinion. 45
The effects of the sun’s rays
All this information is interesting, but so far it does not provide any clear evidence about observatories or observation posts. Returning to the manuscript, we can see that al-Asfī states that on the day of the equinox (March 9), the sunbeam enters through the kuwa, a small window above the mihrāb, and goes beyond the door till the saḥn, or patio, of the zāwiya (Figure 11): Similarly, if the sun we observed at dawn on the equinox, when it rises on 9 March,
46
you will see that its ray enters through the kuwa above the miḥrāb and is projected above the door in front of the aforementioned window, or it leaves towards the yard of the zāwiya if the door is open. The ray may deviate [196r] slightly to the left of the door because, when the sun gains height, after sunrise, its ray deviates towards south and its shadow towards east. To sum up, the miḥrāb of this ribāṭ is the best calculated and oriented towards the qibla of all the mosques of the region. You can learn this from what we mentioned in the qibla’s indicators where it is tested and explained.
47

The solar effects.
The fact that the sunbeam entered the mosque indicates that the eastward orientation of the building was highly accurate with the clear intention of building the mosque towards a qibla calculated by astronomical means. The effect achieved clearly recalls the ones observed with Eastern Islamic sextants and European Christian meridians. Moreover, the use of the verb raṣada, which means “to make an astronomical observation,” implies the true intention to use the mosque building as a sort of observatory or observation post.
Unfortunately, the present-day zāwiya is a modern building and there is no way of examining these effects. In any case, archaeological studies might explain how both this building and the other mosques of the city were oriented.
Conclusion
Authors like al-Asfī are a good example of the interest shown by scholars on the orientation of the qibla. His treatise gives precise data about the orientation of the mosques in Safi. However, the most interesting building is located not in the city, but in the Drâa valley. The ksar of Tamegroute represents a prototype of a centre of learning in which astronomy was not only studied but also practised.
We may venture that the zāwiya described in al-Asfī’s text was the remains of an earlier observatory of some kind.
The zāwiya is a model of a building used as an astronomical tool, because the window above the miḥrāb that al-Asfī described is not usually present in buildings of this kind. The purpose of the window was to observe the spring equinox by means of the entry of the Sun’s rays. This feature prompted al-Asfī to maintain that the zāwiya is the best oriented building in the region of Safi and points to a link with the tradition of giant Eastern instruments and probably with the meridianas in Mediterranean churches mentioned above.
In a context where there is no mention of any observatory, al-Asfī’s work is of paramount importance.
Footnotes
Funding
This work was supported by the Spanish Ministerio de Economía y Competitividad (FFI2011-30092-CO2-01).
Notes on Contributors
![]()
