Ahmad ibn Tulun ( translit. Aḥmad ibn Ṭūlūn‎; ca. 20 September 835 – 10 May 884) was the founder of the Tulunid dynasty that ruled Egypt and Syria between 868 and 905. Originally a Turkic slave-soldier, in 868 Ibn Tulun was sent to Egypt as governor by the Abbasid caliph. Within four years Ibn Tulun had established himself as a virtually independent ruler by evicting the caliphal fiscal agent, Ibn al-Mudabbir, taking over control of Egypt's finances, and establishing a large military force personally loyal to himself. This process was facilitated by the volatile political situation in the Abbasid court and the preoccupation of the Abbasid regent, al-Muwaffaq, with the wars against the Saffarids and the Zanj Rebellion. Ibn Tulun also took care to establish an efficient administration in Egypt. After reforms to the tax system, repairs to the irrigation system, and other measures, the annual tax yield grew markedly. As a symbol of his new regime, he built a new capital, al-Qata'i, north of the old capital Fustat.

After 875/6 he entered into open conflict with al-Muwaffaq, who tried unsuccessfully to unseat him. In 878, with the support of al-Muwaffaq's brother, Caliph al-Mu'tamid, Ibn Tulun took over the governance of Syria as well as the frontier districts with the Byzantine Empire, although control of Tarsus in particular proved tenuous. During his absence in Syria, his eldest son and deputy, Abbas, tried to usurp power in Egypt, leading to the imprisonment of Abbas and the nomination of Ibn Tulun's second son, Khumarawayh, as his heir. The defection in 882 of a senior commander, Lu'lu', to al-Muwaffaq, and the defection of Tarsus, forced Ibn Tulun to return to Syria. Now virtually powerless, al-Mu'tamid tried to escape from his brother's control to Ibn Tulun's domains but was captured by al-Muwaffaq's agents, and Ibn Tulun convened an assembly of jurists at Damascus to denounce al-Muwaffaq as a usurper. His attempt in autumn 883 to bring Tarsus to heel failed, and he fell sick. Returning to Egypt, he died in May 884 and was succeeded by Khumarawayh.

Ibn Tulun stands out as the first governor of a major province of the Abbasid Caliphate to not only establish himself as its master independently of the Abbasid court, but to also pass power on to his son. He was thus also the first ruler since the Ptolemaic Pharaohs to make Egypt an independent political power again, with a sphere of influence encompassing Syria and parts of the Maghreb, setting the tone for later Egypt-based Islamic regimes, from the Ikhshidids to the Mamluk Sultanate of Cairo.