Heka (magic) was already at the heart of Egyptian beliefs by 4000 BCE. Creator deities such as Nu (the watery abyss) were said to have used heka to bring the world into existence from primordial chaos. In doing so, they subdued the forces of chaos, but the forces constantly sought to return and could only be stopped by heka. For the ancient Egyptians, it was not just the gods that handled magic. Lesser supernatural beings, pharaohs, and the dead were thought to possess an element of heka, which they could channel through the use of spells to deflect the attention of malevolent spirits.
The ancient Egyptians also believed in another form of magic power called akhu, which was malign and closely associated with beings of the underworld. To protect against akhu magical practitioners such as priests, scribes in the “Houses of Life”—which held the manuscript collections of Egyptian temples—sunu (doctors), and sau (amulet-makers) employed heka spells, rituals, and magical objects. Indeed, faith in heka was so widespread that ancient Egyptians used it in all aspects of life from matters of state to the delivery of oracles and more mundane village affairs, such as love matches, protection during childbirth, and curing minor illnesses. As well as being an abstract force, there was a god called Heka who personified magic. Heka helped ensure the harmony of the cosmos and acted as a conduit through whom worshippers could seek divine favors. He had a female counterpart, Weret-hekau (Great of Magic), who was depicted in the form of a cobra. It is thought that the snake-headed staffs often used by ancient Egyptian magicians may have represented her.
Sources: A History of Magic, Witchcraft and the Occult