Succession to the pharaonic throne was hereditary in principle, typically passing father to son, but Egyptian practice showed considerable flexibility: pharaohs sometimes named co-regents during their own lifetime to smooth a transition, royal women occasionally ruled in their own right or as effective regents, most famously Hatshepsut in the Eighteenth Dynasty, and marriage among close relatives within the royal family, including sibling marriage, was practiced at various periods, understood partly as preserving the sacred bloodline's purity.
Egypt's political independence was interrupted repeatedly by foreign conquest, each of which nonetheless generally adopted pharaonic titulary and Egyptian religious forms rather than replacing them outright: Nubian pharaohs of the Twenty-fifth Dynasty, Persian rulers during two periods of Achaemenid control, and finally the Macedonian Greek Ptolemaic dynasty founded after Alexander the Great's conquest in 332 BCE, which ruled Egypt as pharaohs in Egyptian religious terms while remaining culturally Greek. The last ruler to hold full pharaonic titulary was Cleopatra VII of the Ptolemaic line, whose defeat and death in 30 BCE, following her and Mark Antony's loss to the future Roman emperor Augustus, brought Egypt under direct Roman administration and ended the pharaonic office.