Fall of Casterly Rock

"Casterly Rock is an impregnable fortress. But as a good friend of mine once said, "Give me ten good men... and I'll impregnate the bitch!""

- Tyrion Lannister to Daenerys Targaryen

The Siege of Casterly Rock is an engagement in Daenerys Targaryen's invasion of Westeros in which the Unsullied army of House Targaryen attacked Casterly Rock, the seat of House Lannister, who traditionally rule the Westerlands.

Casterly Rock had never fallen before, with the exception of the legend of Lann the Clever, who was said to have swindled House Casterly of their stronghold in the Age of Heroes. The Lannisters claim to be descendants of Lann the Clever. Thus, as long as House Lannister has held Casterly Rock, which has been for thousands of years, it has never fallen.

Tyrion Lannister, Hand of the Queen to Daenerys Targaryen, sought to take the castle from Cersei Lannister, using the sewage system of which Tyrion knew through experience to sneak into the castle, as a heavy blow to the Lannister army and morale.

Tyrion and the Unsullied expected a large force to be holding Casterly Rock given that it is the home of House Lannister. However, Jaime Lannister actually used Casterly Rock as a distraction, and instead marched the Lannister army south to the Reach while the Iron Fleet destroyed the Targaryen fleet that had brought the Unsullied, trapping them into the Westerlands.

Prelude
Before becoming the royal family, House Lannister ruled the Westerlands from their stronghold of Casterly Rock. When Robert Baratheon took the Iron Throne after his rebellion against House Targaryen and House Baratheon became the new royal family, he was wed to Cersei Lannister. After Robert's death, Cersei saw that Joffrey Baratheon took the throne; though Joffrey, Myrcella, and Tommen Baratheon were said to be Robert's children, they were actually bastards born of incest between Cersei and Jaime Lannister. The revelation of this led to a major civil war, the War of the Five Kings, and House Baratheon was divided among three branches. Ultimately, House Baratheon of King's Landing held onto the crown, though they were nothing more than a puppet of House Lannister, which had been the true power in the Seven Kingdoms. However, after the destruction of the Great Sept of Baelor, the Baratheons went extinct, and Cersei Lannister seized the Iron Throne, thus bringing the Lannisters to full power.

Nonetheless, Cersei's destruction of the Great Sept of Baelor united her many enemies to fight alongside Daenerys Targaryen, who sought to restore her family to the Iron Throne. Tyrion Lannister, Cersei and Jaime's younger brother, also served Daenerys as her Hand and intended to remove his family from power. To this end, he developed a strategy to take Casterly Rock using the elite Unsullied army, commanded by Grey Worm, that Daenerys brought over from Essos, which would cut off the Lannisters from their stronghold and would also deal a heavy blow against the Lannister morale given that Casterly Rock is their traditional seat of power. Tyrion expected a large force to be holding Casterly Rock because of this; the castle had also never fallen before.

Cersei, however, gained an ally in Euron Greyjoy, the new King of the Iron Islands. The Iron Islands are part of the Seven Kingdoms, though have sought independence from the Iron Throne since the War of the Five Kings broke out. Euron originally intended to form a pact with Daenerys but was beaten by his niece and nephew, Yara and Theon Greyjoy, who opposed Euron after he murdered their father and the preceding king, Balon Greyjoy, and sought to place Yara on the Salt Throne. The location of Euron's fleet, however, remained unknown to the Targaryens.

The battle
Transported by a large portion of the Targaryen fleet, the Unsullied army of House Targaryen landed at Casterly Rock, where they attempted to climb over the battlements with ladders. The Lannister garrison had anticipated the attack, and fiercely defended the walls firing arrows and throwing large stones. The Unsullied took heavy casualties and could not seem to breach the walls. However, Grey Worm led a small force of Unsullied through the sewers beneath the Rock provided by Tyrion Lannister, who installed a route that he would use to sneak in with prostitutes. Once inside the castle, Grey Worm and his force opened the gates, allowing the rest of the Unsullied army to pour in. Following fierce fighting, the Lannister men were ultimately overpowered.

Aftermath
After the fighting finished and the Lannister garrison had been destroyed, Grey Worm quickly deduced that the a large part of the Lannister army was mysteriously absent from the assault. He looks over the battlements to see Euron Greyjoy and the Iron Fleet destroying their ships. Out of anger, Grey Worm grabs a dying Lannister soldier and asks where the rest of the Lannisters are. As it turns out Jamie had marched the Lannister host to take Highgarden. After taking the castle he later comments to Olenna that the Unsullied would be unable to hold Casterly Rock as he had emptied all the larders and would starve unless they left, and with their fleet burned by Euron they would have no choice but to march cross country through a hostile Westeros.

In the books
In the A Song of Ice and Fire novels by George R.R. Martin, an equivalent battle has not occurred. The TV show has surpassed the timeline of the books, so it is unclear if an equivalent battle will occur or not.