When the Assyrian city of Nineveh was sacked by the Medes and the Babylonians in 612 BC, the library was set on fire and the upper floors caved in. The fire baked the clay tablets into terracotta, which allowed them to survive for thousands of years, when archaeologists dug them up.