<Tr> <Td> <Ul> <Li> </Li> <Li> </Li> <Li> </Li> </Ul> </Td> </Tr> <Ul> <Li> </Li> <Li> </Li> <Li> </Li> </Ul> <P> 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 world . 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 . </P> <P> Individuals could interact with the gods for their own purposes, appealing for their help through prayer or compelling them to act through magic . These practices were distinct from, but closely linked with, the formal rituals and institutions . The popular religious tradition grew more prominent in the course of Egyptian history as the status of the Pharaoh declined . Another important aspect was the belief in the afterlife and funerary practices . The Egyptians made great efforts to ensure the survival of their souls after death, providing tombs, grave goods, and offerings to preserve the bodies and spirits of the deceased . </P>

What was the main religion of ancient egypt
find me the text answering this question