By the time Davani had reached his thirties, his reputation as a religious scholar had already been established. He briefly served as the
sadr (chief of religious affairs) of the Qara Qoyunlu governor of Fars,
Mirza Yusuf, but soon resigned. It is unknown why he resigned from his post; regardless, Davani still retained a close relationship with Mirza Yusuf's father,
sultan Jahan Shah (). He accompanied the latter in his battle against the
Aq Qoyunlu ruler
Uzun Hasan (), which took place on the field of Mush in
Diyar Bakr in on 10 or 11 November 1467. Jahan Shah's forces were defeated, and he was himself killed. Davani fled to the city of
Tabriz in the northwestern Iranian region of
Azerbaijan, losing some of his books in the process. realm under
Uzun Hasan () in 1478 There he stayed for a while, composing the
Shawakil al-hur fi sharh Hayakil al-nur a commentary on the
Hayakil al-Nur, a work by the 12th-century Persian philosopher
Suhrawardi (died 1191). The commentary is dedicated to
Mahmud Gawan (died 1481), the Persian
vizier of the
Bahmanid sultan of the
Deccan,
Muhammad Shah III Lashkari (). Some years later, Davani returned to Shiraz and became the
mudarris (teacher) of the Begum Madrasa (later known as Dar al-Aytam). It was that there he established a relation with the Aq Qoyunlu, especially with Uzun Hasan's son
Sultan Khalil, who governed Fars. In 1474, Davani dedicated ethical work ''Lawami' al-ishraq fi makarim al-akhlaq
(also known as Akhlaq-i Jalili'') to Uzun Hasan and Khalil. In this work, he described Uzun Hasan as "the shadow of God, the caliph of God, and the deputy of the Prophet". In September/October 1476, Davani wrote an eyewitness report of a military parade by Khalil at the ruins of ancient
Achaemenid city of
Persepolis. He credited the
mythological Iranian king
Jamshid as the founder of the city, and associated him with
Solomon, a common association in Iranian literary traditions. During Khalil's brief rule in 1478, Davani dedicated another of his works to him; an explanation of
Ali Qushji's (died 1474) commentary on the ''Tajrid al-i'itiqad'' by the 13th-century Persian scholar
Nasir al-Din Tusi. Following Khalil's premature death in August 1478, his brother
Ya'qub Beg () succeeded him, and appointed Davani as the
qadi of Fars. Davani also accepted Ya'qub's invitation to the court in Tabriz. However, Davani opposed the later centralization reforms of Ya'qub, and thus their relations worsened. Together with Abu-Yazid al-Davani and Maulana Muhammad al-Muhyavi, Davani sent letters to Ya'qub's vizier
Qazi Isa Savaji to protest these reforms. During Ya'qub's reign, most of Davani's work was dedicated to figures outside Iran. A close friend of the
Ottoman sultan
Bayezid II (), Mu'ayyadzade Abd al-Rahman Efendi (died 1516), arrived to Shiraz in 1479, where he studied under Davani until 1483. It was through Mu'ayyadzade that Davani established a network with Bayezid II. Davani dedicated three of his works to the latter; the ''Sharh al-Ruba'iyyat
, Risalat Ithbat al-wajib al-qadima
, and al-Hashiya al-jadida
. As a gratitude for his Risalat Ithbat al-wajib al-qadima
, Bayezid II gifted Davani 500 florins. The Ottoman ulama (clergy) also praised his work. Davani dedicated his Unmudhaj al-ulum
and Tahqiq-i adalat'' to the sultan of the
Gujarat Sultanate,
Mahmud Begada (), and was in return rewarded 1000
dirhams. With the constant flow of gifts that Davani was receiving from his patrons, he eventually became rich. However, all of his belongings were soon confiscated in 1498 or 1499 by the Aq Qoyunlu ruler of Fars, Qasim-Bay Purnak. Davani afterwards spent much of his time in various small cities south of Shiraz. Some sources report that Davani planned to accept the invitation of the
Samma sultan
Nizam al-Din Shah Sindhi () and leave for India. Two of Davani's students, Mir Shams al-Din Muhammad al-Jurjani (a great-grandson of the prominent
al-Sharif al-Jurjani), and Mir Mu'in al-Din, were already present at Nizam al-Din's court. This may explain why Davani went to Jirun (
Hormuz), an island in the
Persian Gulf. Davani also went to the city of
Lar, where he completed his
Risalat Ithbat al-wajib al-qadima and
Diwan-i Mazalim. Davani reportedly disapproved the
messianic claims of the
Safavid shah (king)
Ismail I (), who had captured the Aq Qoyunlu capital of Tabriz in 1501. Regardless, it is presumed that Davani's undated work
Nur al-hidaya was written during this period, in which Davani espoused pro-
Shi'ism, probably in hope of appeasing the Shia Safavids. Davani died soon after, in the month of October or November in 1502. He was buried in a mausoleum named Bogh'a-ye Shaykh-e Ali in his hometown of Davan. Approximately two years later (in 1504), Shiraz was captured by Ismail I, who had the Sunni clerics who were unwilling to convert to Shi'ism executed. == Legacy ==