Ancient Egyptian religion was a complex system of polytheistic beliefs and rituals which were an integral part of ancient Egyptian society. It centered on the Egyptians' interaction with many deities who were believed to be present in, and in control of, the forces of nature. Rituals such as prayers and offerings were efforts to provide for the gods and gain their favor. Formal religious practice centered on the pharaoh, the ruler of Egypt, who was believed to possess a divine power by virtue of their position. They acted as the intermediary between their people and the gods and was obligated to sustain the gods through rituals and offerings so that they could maintain order in the universe. The state dedicated enormous resources to Egyptian rituals and to the construction of the temples.