Set (sometimes spelled Seth) is a deity found in the mythology of ancient Egypt, usually depicted as the traitor among the Egyptian gods, his official titles are the God of chaos, desert, storms and foreigners. He is depicted with the head of an unknown creature, one which may even be extinct today. Originally Set was held in high regard due to his status a desert divinity but over the course of time would become increasingly negative until he became the antagonistic figure he is recognized as in modern mythology. This mainly began during the Hyksos invasion of the First Intermediate Period directly after the Old Kingdom, when Egypt was invaded and conquered by the Hyksos, who favored Set.
Set, was not originally the prime evil figure in Egyptian mythology, as that title belongs to Apep, the evil god of darkness. Apep fought against Ra, God of light and the sun, and Set was one of the gods who protected and aided Ra. Set becomes the antagonist in the Osiris myth, where he opposes his brother Osiris, who symbolized order, and his nephew Horus.
Set was born from the earth god Geb and the sky goddess Nut, along with his twin-sister Nephtys, who also became his wife. Nut and Geb also gave birth to the twins Osiris and Isis, who became the king and queen of Egypt. Set became jealous of his brother, and sought to usurp his throne. He eventually killed Osiris by trapping him in a casket and dropping him into the Nile, taking control of Egypt. The casket flows into the sea, gets washed up and encased in a tree. After Isis finds it, Set finds out and dismembers Osiris before Isis can resurrect him, spreading his corpse parts around Egypt. Isis, with the help of Nephtys, sougth to collect the parts of his husband's corpse, while Set became king. The two goddesses collect all parts, and with the help of Thoth and Anubis, they ressurrect Osiris for a brief period, enough for Isis to conceive their son, Horus.
Isis hides along with her son, so that she can raise him while protecting him from Set. Horus eventually reaches adulthood, and challenges Set for the throne. Their struggle drags for eight years, but Horus prevails. Set attempts to rape Horus after his defeat but Horus castrates him, while set removes Horus eyes. At this moment Thoth steps in to mediate the conflict, restoring the two and declaring Set's defeat. As the conflict ends, the two deities reconcile, as Horus rules over the fertile regions of Nile while Set is given rule over the desert and the foreign lands. Horus finally reclaims the throne as the rightful king of Egypt, and gives his father Osiris a proper funeral, restoring him in his afterlife, as Osiris becomes ruler of the dead.
Modern Kemetic pagans are usually more forgiving of Set than were the ancients, as it is understood he represents darkness and chaos, which are just as important to the balance of Ma'at as light and order are.