Derinkuyu- The largest undergroud city on the planet, an ancient refuge

Derinkuyu in Turkey was built 2,800 years ago or more to house 20,000 people underground. Why did they need to take refuge?