Egyptian temples were built for the official worship of the gods and in commemoration of the pharaohs in ancient Egypt and regions under Egyptian control. Temples were seen as houses for the gods or kings to whom they were dedicated. Within them, the Egyptians performed a variety of rituals, the central functions of Egyptian religion: giving offerings to the gods, reenacting their mythological interactions through festivals, and warding off the forces of chaos. These rituals were seen as necessary for the gods to continue to uphold maat, the divine order of the universe. Housing and caring for the gods were the obligations of pharaohs, who therefore dedicated prodigious resources to temple construction and maintenance. Out of necessity, pharaohs delegated most of their ritual duties to a host of priests, but most of the populace was excluded from direct participation in ceremonies and forbidden to enter a temple's most sacred areas. Nevertheless, a temple was an important religious site for all classes of Egyptians, who went there to pray, give offerings, and seek oracular guidance from the god dwelling within.