It stated this was because Sultan Mehmet II, the conqueror of Istanbul, had in 1453 converted the Byzantine cathedral into a mosque, established a pious foundation, and donated the Hagia Sophia mosque to this foundation. Therefore, the allocation of the Hagia Sophia for a purpose other than a mosque was considered by the court to be inconsistent with the will of the founder of the pious foundation.

https://arab.news/bx2gt