Riot of King's Landing

"They threw a cowpie at you, so you decide to kill them all?! They're starving, you fool! All because of a war you started!"

- Tyrion Lannister to King Joffrey Baratheon

The Riot of King's Landing was an event during the War of the Five Kings. After seeing off Princess Myrcella Baratheon at the docks on a ship bound for Dorne, the royal procession including King Joffrey is subjected to the jeers of the starving crowds of the capital city, culminating in Joffrey foolishly ordering his outnumbered personal guard to execute the entire crowd, sparking off a city-wide riot.

Background
Since the outbreak of the War of the Five Kings, the problems in King's Landing have multiplied, particularly the worsening food shortages. The Crownlands do not produce enough food to feed the large population of King's Landing, so food is mostly imported from the Reach and the Riverlands. Food from the Riverlands stops arriving, because House Tully has sided with Robb Stark's rebellion, and the southern portions of the Riverlands occupied by Lannister armies have either been foraged to feed the occupation force or put to the torch. Meanwhile, House Tyrell of the Reach has sided with King Renly Baratheon, cutting off food shipments to the capital along the Roseroad. Despite the recent assassination of Renly, House Tyrell is still wavering on which faction to align with.

The war in the Riverlands has also brought a large influx of refugees into King's Landing, seeking the protection of the city walls. This drastically exacerbates the food shortages. Lord Commander Janos Slynt of the City Watch had desperately tried to convince Queen Cersei that the dire situation was spiraling out of control, as did her brother Tyrion, but she waved aside such concerns.

Furthermore, thanks to the letter sent by Stannis Baratheon to all corners of the realm, the rumors about Joffrey's parentage, that he is really the incestuous offspring of Cersei and her brother Jaimie, are spreading among the nobles and the smallfolk. The commoners were also recently incensed by the massacre of Robert Baratheon's bastard children carried out by the City Watch on Joffrey's (or the Queen's) orders.

The Riot
As the royal procession works their way back to the Red Keep, crowds of peasants gather around them, and some began sarcastically shouting empty praise at Joffrey. Soon they are begging for bread. as they are starving due to the disruptions in trade caused by the war. After being subjected to the japes and jests of the crowd, including shouts of "bastard!", "monster of incest!", "Stannis!", and a sarcastic "Hail King Joffrey!" someone throws a cow pie at Joffrey's head.

Enraged at the excrement thrown in his face, Joffrey demands that his guards seize whoever threw it. With mounting frustration at the scuffling between his guards and the commoners nearby, Joffrey becomes livid, and screams: "Just kill them! Kill them all!" However, Joffrey discovers that his orders count for little when his guards are heavily outnumbered by an angry mob, rather than in the safety of the Red Keep with its large garrison. His few dozen guards are quickly overwhelmed by hundreds of panicking and angry commoners and refugees. The High Septon is dragged down screaming by the crowd and literally torn to pieces.

The Kingsguard carve a path through the mob with their swords, barely managing to rush Joffrey, Cersei, and Tyrion to the security of the Red Keep. Joffrey, still hysterically demanding that all the rioters be executed, is slapped and scolded by Tyrion for inciting the starving crowd and absurdly overreacting to having cow dung thrown at him. Tyrion realizes that in the commotion, Sansa Stark has been separated from the group. Joffrey petulantly refuses to order his Kingsguard to rescue her, even though she is a vital hostage and if any harm comes to her, Joffrey's uncle will be killed by the Starks in retaliation. Sansa is nearly raped before Sandor Clegane saves her and brings her to the Keep. When Tyrion thanks Sandor for saving Sansa and averting a political disaster, he responds, "I didn't do it for you."

Aftermath
Much of the city remains in chaos for some time, with random violence and looting spreading across the capital. The pent up frustrations with Lannister rule and the starvation conditions in the city which Queen Cersei had flippantly ignored for months now came back to haunt Joffrey's court. So far, along with the Battle of Blackwater, this has been one of two occasions during his reign in which Joffrey was very nearly deposed-and killed. It also served to show how little loyalty he really had among the people.

In the books
In the books, the Riot of King's Landing is considerably more violent. The party of nobles and their guards are on horseback not on foot. The riot begins after a woman walks out before King Joffrey's horse, halting the procession. She holds up her dead baby, which died from malnutrition. Tyrion sees Sansa say something to Joffrey, and Joffrey callously tosses one silver coin at the woman. It bounces off the dead baby to roll into the crowd, where people fight over it. The woman begins screaming insults at Joffrey and Cersei- shouting that they are a "bastard" and a "brother-fucker", respectively. The crowd takes this up as well and then someone throws manure at Joffrey and he demands the culprit to be executed. He foolishly sends the Hound in the general direction of where the crowd said the culprit was, and this angers the crowd. Curses shower down on the party, further inflaming the situation. Tyrion desperately tries to calm the situation by telling the Hound not to bother, but when Joffrey orders Clegane to cut through the crowd, the riot breaks out.

In the ensuing violence, Ser Preston Greenfield of the Kingsguard and Ser Aron Santagar, the Red Keep's master-at-arms are killed. Nine Gold Cloaks are also killed and forty are wounded. Lollys Stokeworth - the feeble-witted second daughter of old Lady Tanda Stokeworth - is raped by dozens of men, and is found wandering naked and in shock by the Gold Cloaks. Tyrek Lannister, one of Robert's former squires and son of Tyrion's late uncle Tygett, simply disappears, his body never found. Nobody bothers to count all the dead rioters. The High Septon is also torn limb from limb in the book, leading Tyrion to quip that "starving men take a dim view of priests too fat to walk". His crystal crown is also stolen.

The book does not indicate if there was an attempt to rape Sansa. The Hound does rescue her and bring her back within the castle after all of the knights inside refuse to risk going out again, but this chapter is narrated from Tyrion's POV so the details of her rescue are not shown. When she is brought back, she has a deep bleeding gash on her scalp, and says, "They... they were throwing things... rocks and filth, eggs... I tried to tell them, I had no bread to give them. A man tried to pull me from the saddle. The Hound killed him, I think. His arm... he cut off his arm."

After the riots, Tyrion orders a curfew from dusk to dawn, with the penalty that anyone found on the streets will be executed. This measure is horribly unpopular, but curtails the nightly murder-robberies that have been taking place. The growing danger in the city is what prompts Tyrion to bring Shae into the Red Keep for safety. With Varys' help he gets her a position as handmaiden to Lollys Stokesworth, who becomes pregnant after being raped. Tyrion and Varys both try very hard to find Tyrek Lannister, to no avail.