Sack of King's Landing

"I was in King's Landing after the sack, khaleesi. Do you know what I saw? Butchery. Babies, children, old men. More women raped than you can count."

- Ser Jorah Mormont to Daenerys Targaryen

The Sack of King's Landing was the event that ended Robert's Rebellion and consisted of a devastating assault on the city of King's Landing by the army of House Lannister, after they had been welcomed inside the city gates as allies. Due to this treachery, it was more of a massacre than an actual battle. During the sack, as Lannister soldiers rampaged throughout the city, the Mad King, Aerys II Targaryen, was slain along with most of his loyal retainers and those family members who had not fled to the island of Dragonstone.

Lord Tywin Lannister was the architect of the victory and commanded the assault as a way of proving his loyalty to Robert Baratheon after deciding to join the war very late in the day.

As the city was sacked, Ser Jaime Lannister, a member of the Kingsguard, turned on and slew the Mad King, an act of treachery which earned him the name "Kingslayer", even though King Robert later pardoned him for this act.

Season 1
The singer Marillion offers to sing Tyrion Lannister a song about his father's victory at King's Landing, the thought of which turns Tyrion's stomach.

Catelyn Stark talks to her son Robb about the Sack of King's Landing. She mentions that Tywin Lannister slew the young Targaryen children, referring to the murders of Prince Aegon and Princess Rhaenys, and how he has not gotten any more merciful with age.

At Castle Black, Aemon, revealing himself to be the uncle of the Mad King, tells Jon Snow how he heard of the ruin of his house. He becomes angry when talking about the slaughter of the children.

Season 3
Thoros of Myr recalls how, following the sack of the city, the bodies of Prince Aegon and Princess Rhaenys were presented by Ser Gregor Clegane before the Iron Throne. Jaime reveals to Brienne that, when his father marched to the gates of King's Landing, both Jaime and Varys advised Aerys not to trust Lord Tywin. Aerys, however, followed Grand Maester Pycelle's counsel and had the city gates opened, allowing the Lannister forces to sack the city. Jaime advised Aerys to surrender, only for the Mad King to demand Jaime bring his father's head and order Lord Rossart to ignite the caches of wildfire hidden throughout the city to burn it to the ground with all its inhabitants. Jaime killed Rossart and then Aerys, who kept muttering "burn them all" as he died. Aerys seemingly believed the massive wildfire inferno would also transmute him into a dragon. Afterward, Eddard Stark reached the throne room and found Jaime along with the two corpses.

In the books
In the A Song of Ice and Fire novels, the Sack of King's Landing is described as a particularly brutal and treacherous battle. During Robert's Rebellion, the forces of Houses Stark, Baratheon, Arryn and Tully had fought against those houses owing direct allegiance to House Targaryen, but of the other Great Houses only House Tyrell had sworn themselves to the Mad King's cause, and most of their forces were tied down in the south, besieging the Baratheon stronghold of Storm's End. House Martell of Dorne had reluctantly committed troops to the Targaryen cause only because the Mad King held Princess Elia Martell, the wife of Prince Rhaegar Targaryen, in King's Landing as a virtual hostage. The Martells were insulted by Rhaegar having started the war in the first place by taking Lyanna Stark as a lover, dishonoring his own marriage to Elia.

During the fighting, House Greyjoy refused to take any part and House Lannister similarly sat out the bulk of the war, Lord Tywin having felt insulted by many of the Mad King's own actions in the preceding years such as rejecting a proposed marriage between Tywin's daughter Cersei and Prince Rhaegar and appointing Tywin's first son and heir Jamie to the Kingsguard - normally a great honor, but which insulted Tywin because it meant Jaime could not inherit Tywin's lands and title. However, after Robert's victory at the Battle of the Trident Tywin, realizing the war was as good as won, rushed his army to King's Landing. In front of the city gates, he proclaimed that the Lannister force had come to defend the city from the rebel army rushing south under Eddard Stark. Following the advice of Grand Maester Pycelle, Aerys had the city gates opened to the "reinforcements", only for the Lannister troops to betray the city defenders and put them to the sword. The city was brutally sacked, with thousands of smallfolk caught up in the fighting and killed as well as soldiers on both sides. In later years, Tywin explained his reasons for acting with such haste; with the war nearly over, Tywin knew House Lannister's loyalty to the new regime would forever be in doubt unless he proved unequivocally he had forsaken all loyalty to the Targaryens. Tywin also relates that he feared a delay might bring him into conflict with Eddard Stark, who was marching on King's Landing from the Trident, along with his fear that Jaime, still in the king's power, might do something stupid or Aerys might kill him out of sheer spite.

During the battle, Ser Jaime Lannister killed Lord Rossart and afterward killed the Mad King by slitting his throat (not by stabbing him in the back as told on the show) at the foot of the Iron Throne, thus foiling Aerys' plan to destroy the entire city by wildfire. Roland Crakehall and Elys Westerling, Knights loyal to his father, burst into the throne room to see the end of the incident, ensuring that Jaime would forever be known as "the Kingslayer".

During the closing stages of the battle, Lannister troops scaled Maegor's Holdfast and killed Princess Elia Martell and her two children, Princess Rhaenys Targaryen and Prince Aegon. According to rumor, the dread knight Gregor Clegane performed horrible deeds during this event.

The death of the Mad King and his grandchildren saw the end of Robert's Rebellion and allowed Robert Baratheon to claim the Iron Throne, even though the Mad King's son and daughter Viserys and Daenerys had escaped to the Free Cities to live in exile. Due to the death of Princess Elia, Dorne and House Martell withdrew from active involvement in the affairs of the rest of Westeros afterwards.