The Hagia Sophia, i.e. the Church was destroyed in 532 under the rule of Justinian, as a result of the Nika riots.
Step-by-step explanation:
The Emperor Justinian, was aware that he wasn't very popular with the the citizens of Rome. In order to tackle this issue, he decided to conduct a chariot race on January 13th, 532 between two fans, one from the Blues and from the Greens, which were chariot teams that The Byzantines supported.
While the race was ongoing, the fans started throwing insults at the emperor and became uncontrollable. The word "Nika" means to "win" or "conquer" and the fans started shouting this.
As the tension grew, they started destroying parts of the city and in this process, the church also got destroyed.