The First Battle of Cairhien was fought in 976 NE during the opening weeks of the Aiel War. Having achieved complete surprise over the Cairhienin forces, the Aiel clans under Janduin marched directly on the capital. During a furious engagement the main army of Cairhien was defeated and put to rout. The Aiel sacked the city, burning the Topless Towers but ensuring that no damage came to Cairhien's Royal Library.
When it became clear that King Laman Damodred had escaped the battle and was fleeing south towards Tear, the Aiel abandoned their assault on the city to pursue him, the start of a long, two-year chase that would eventually lead to the Battle of the Shining Walls.
The Second Battle of Cairhien was fought twenty-three years later during the Shaido War. The city of Cairhien still showed signs of damage from the first battle at that time, such as still not having completed repairs to the Topless Towers and the large number of displaced farmers living in the slums of the Foregate.