In 1453 CE, the Ottomans conquered Constantinople, and they turned the Hagia Sophia cathedral into a mosque. Were either of these two acts Islamically allowed?
We don't approve all the acts of Ottomans' rulers. They were just rulers like other Muslim and non Muslim rulers who were mainly after their political aims and plans.
History says that people of Constantinople became Muslims and they willingly started using the building as a Mosque.
Wassalam.