The ancient Roman and Byzantine Empires had well-developed associations which supported the different factions (or teams) under which competitors in certain sporting events competed; this was particularly true of chariot racing. There were four major factional teams of chariot racing, differentiated by the colour of the uniform in which they competed; the colours were also worn by their supporters. These were the Blues, the Reds, the Greens, and the Whites, although by the Byzantine era the only teams with any influence were the Blues and Greens. The emperor Justinian I was a supporter of the Blues.
The team associations had become a focus for various social and political issues for which the general Byzantine population lacked other forms of outlet. They combined aspects of street gangs and political parties, taking positions on current issues, notably religion and disputes between claimants to the throne. They frequently tried to affect the policy of the Emperors by shouting political demands between the races. The imperial forces and guards in the city could not keep order without the cooperation of the circus factions which were in turn backed by the powerful aristocratic families of the city: this included some families who believed they had a more rightful claim to the throne than Justinian.
Setting the stage for the revolt, in 531 some members of the Blues and Greens had been arrested for murder in connection with deaths that occurred during rioting after a recent chariot race. Relatively limited riots were not unknown at chariot races, similar to the mayhem that very occasionally erupts after an association football championship in modern times. The murderers were to be hanged, and most of them were. But on January 10, 532, two of them, a Blue and a Green, escaped and were taking refuge in the sanctuary of a church surrounded by an angry mob.
Justinian was nervous: he was in the midst of negotiating with the Persians over peace in the east, there was enormous resentment over high taxes, and now he faced a potential crisis in his city. Facing this, he declared that a chariot race would be held on January 13 and commuted the sentences to imprisonment. The Blues and Greens responded by demanding that the two men be pardoned entirely.
On January 13 a tense and angry populace arrived at the Hippodrome for the races. The Hippodrome was next to the palace complex and thus Justinian could watch from the safety of his box in the palace and preside over the races. From the start the crowd had been hurling insults at Justinian. By the end of the day, at race 22, the partisan chants had changed from "Blue" or "Green" to a unified Nίκα ("Nika", meaning "Win!" or "Conquer!"), and the crowds broke out and began to assault the palace. For the next five days the palace was under virtual siege. The fire that started during the tumult resulted in the destruction of the (second) Hagia Sophia on 13 January 532.
Some of the senators saw this as an opportunity to overthrow Justinian, as they were opposed to his new taxes and his lack of support for the nobility. The rioters, now armed and probably controlled by their allies in the Senate, also demanded that Justinian dismiss the prefect John the Cappadocian, who was responsible for tax collecting, and the quaestor Tribonian, who was responsible for rewriting the legal code. They then declared a new emperor, Hypatius, who was a nephew of former Emperor Anastasius I.
Justinian, in despair, considered fleeing, but his wife Theodora is said to have dissuaded him, saying, "Those who have worn the crown should never survive its loss. Never will I see the day when I am not saluted as empress. Although an escape route across the sea lay open for the emperor, Theodora insisted that she would stay in the city, quoting an ancient saying, "Royalty is a fine burial shroud," or perhaps, [the royal color] "Purple makes a fine winding sheet."
Justinian did not wish to flee, either. He created a plan that involved Narses, a popular eunuch, as well as the generals, Belisarius and Mundus. Carrying a bag of gold given to him by Justinian, the slightly built eunuch entered the Hippodrome alone and unarmed, against a murderous mob that had already killed hundreds. Narses went directly to the Blues' section, where he approached the important Blues and reminded them that the Emperor Justinian supported them over the Greens. He also reminded them that the man they were crowning, Hypatius, was a Green. Then, he distributed the gold. The Blue leaders spoke quietly with each other and then they spoke to their followers. Then, in the middle of Hypatius' coronation, the Blues stormed out of the Hippodrome. The Greens sat, stunned. Then, Imperial troops led by Belisarius and Mundus stormed into the Hippodrome, killing the remaining rebels.
About thirty thousand rioters were reportedly killed. Justinian also had Hypatius executed and exiled the senators who had supported the riot. He then rebuilt Constantinople and the Hagia Sophia, and was free to establish his rule of law.