In recent years, we have witnessed an efflorescence of research on Islamic esoteric traditions and occult thought. Such scholarly activity has established that the occult sciences are part of Islamic intellectual history that cannot be overlooked; rather, they constituted a primary mode by which people thought about the hidden, the extraordinary, and their potential for partaking in the divine and wondrous. Occult beliefs and practices are thus inextricably embedded in philosophical, scientific, and religious discourses. This article focuses on occult thought in medieval Islam (second-seventh/eighth-thirteenth centuries), particularly in its relation to the ways in which nature and the divine were perceived and experienced. I argue that medieval Islamic occult sciences distinguished themselves from forbidden siḥr or sorcery by identifying legitimate conditions of acquiring power on the basis of two differing paradigms: by association with natural philosophy on the one hand, and by association with Sufism on the other. A shift of emphasis occurred in the medieval period: from the second/eighth to the fifth/eleventh centuries, legitimisation of occult practices derived mainly from natural philosophy, stressing causation and knowledge of signs as the core principles of magical efficacy. By the seventh/thirteenth century, however, occult practices were increasingly justified on the basis of mystical and Sufi doctrines. During the first phase, magic was generally deemed natural, inasmuch as it functioned according to a causality proven empirically and understood rationally; during the second phase, the power of extraordinary acts, including magic, became the prerogative of a select group who has achieved non-rationalised revelation and theophany, which undermined natural causality and transformed signs from indicators of natural links into tokens of God and the spiritual agents mediating between Him and the gnostic. Scholars such as Pierre Lory, Constant Hamès, and Toufic Fahd have noted the difference between the magic of early Islam and that of the later Middle Period; however, this article elaborates on the epistemological transformations in this period and their implications for cosmological and ontological structures that had a direct impact on magical theory and practice.