Nectanebo I had gained control of all of Egypt by November of 380 BC, but spent much of his reign defending his kingdom from Persian reconquest with the occasional help of Sparta or Athens. In 365 BC, Nectanebo made his son Teos co-king and heir, and until his death in 363 BC father and son reigned together. After his father's death, Teos invaded the Persian territories of modern Syria and Israel and was beginning to meet with some successes when he lost his throne due the machinations of his own brother Tjahepimu. Tjahepimu took advantage of Teos' unpopularity within Egypt by declaring his son—and Teos' nephew--Nectanebo II—king. The Egyptian army rallied around Nectanebo which forced Teos to flee to the court of the king of Persia.
Nectanebo II's reign was dominated by the efforts of the Persian rulers to reconquer Egypt, which they considered a satrapy in revolt. For the first ten years, Nectanebo avoided the Persian reconquest because Artaxerxes III was forced to consolidate his control of the realm. Artaxerxes then attempted an unsuccessful invasion of Egypt in the winter of 351/350 BC; the repercussions of his defeat prompted revolts in Cyprus, Phoenicia, and Cilicia. Although Nectanebo gave support to these revolts, Artaxerxes would eventually suppress these rebellions and was once again able to invade Egypt in 343 BC. This second invasion proved successful, and Nectanebo was forced to withdraw from his defenses in the Nile Delta to Memphis, where he saw that his cause was lost. He thereupon fled south to Nubia, where he is assumed to have found refuge at the court of King Nastasen of Napata. Nectanebo, however, may have managed to maintain some form of independent rule in the south of Egypt for 2 more years since a document from Edfu is dated to his eighteenth year.
Although a shadowy rebel Khababash proclaimed himself king (338 - 336 BC), Nectanebo has been considered the last native pharaoh of Egypt, and his flight marked the end of Egypt as an independent entity.