What was the purpose of the ziggurat in Mesopotamia?

Containment for the domesticated livestock.

Temples that were built as a shrine to the clan’s protecting god.

Large scale housing for the city.

Storage for the grain that was produced.