As a very simple desciption of complex history, the Basilica of the Hagia Sophia was built in 360 as an Eastern Orthodox church in Constantinople. Earthquakes, wars, political disruptions, etc. caused it to have a complex history with considerable damage and rebuilding at avrious times - it was turned in to a Mosque in 1453. In 1935 it was turned into a museum. There is a movement to turn it into a Mosque again. As in many historical building there is renovation work underway so some of the views are messed up.
We could see it from the roof of our hotel. and it was the first place that we visited.