After Egypt's central government collapsed at the end of the Old Kingdom, the administration could no longer support or stabilize the country's economy. Regional governors could not rely on the king for help in times of crisis, and the ensuing food shortages and political disputes escalated into famines and small-scale civil wars. Yet despite difficult problems, local leaders, owing no tribute to the pharaoh, used their newfound independence to establish a thriving culture in the provinces. Once in control of their own resources, the provinces became economically richer—a fact demonstrated by larger and better burials among all social classes. In bursts of creativity, provincial artisans adopted and adapted cultural motifs formerly restricted to the royalty of the Old Kingdom, and scribes developed literary styles that expressed the optimism and originality of the period.

Free from their loyalties to the pharaoh, local rulers began competing with each other for territorial control and political power. By 2160 BC, rulers in Herakleopolis controlled Lower Egypt, while a rival clan based in Thebes, the Intef family, took control of Upper Egypt. As the Intefs grew in power and expanded their control northward, a clash between the two rival dynasties became inevitable. Around 2055 BC the Theban forces under Nebhepetre Mentuhotep II finally defeated the Herakleopolitan rulers, reuniting the Two Lands and inaugurating a period of economic and cultural renaissance known as the Middle Kingdom

Second Intermediate Period and the Hyksos

Around 1650 BC, as the power of the Middle Kingdom pharaohs weakened, Asiatic immigrants living in the Eastern Delta town of Avaris seized control of the region and forced the central government to retreat to Thebes, where the pharaoh was treated as a vassal and expected to pay tribute. The Hyksos ("foreign rulers") imitated Egyptian models of government and portrayed themselves as pharaohs, thus integrating Egyptian elements into their Middle Bronze Age culture.

After their retreat, the Theban kings found themselves trapped between the Hyksos to the north and the Hyksos' Nubian allies, the Kushites, to the south. Nearly 100 years of tenuous inaction followed, and it was not until 1555 BC that the Theban forces gathered enough strength to challenge the Hyksos in a conflict that would last more than 30 years.The pharaohs Seqenenre Tao II and Kamose were ultimately able to defeat the Nubians, but it was Kamose's successor, Ahmose I, who successfully waged a series of campaigns that permanently eradicated the Hyksos' presence in Egypt. In the New Kingdom that followed, the military became a central priority for the pharaohs seeking to expand Egypt’s borders and secure her complete dominance of the Near East.

Third Intermediate Period

Following the death of Ramesses XI in 1078 BC, Smendes assumed authority over the northern part of Egypt, ruling from the city of Tanis. The south was effectively controlled by the High Priests of Amun at Thebes, who recognized Smendes in name only.During this time, Libyans had been settling in the western delta, and chieftains of these settlers began increasing their autonomy. Libyan princes took control of the delta under Shoshenq I in 945, founding the so-called Libyan or Bubastite dynasty that would rule for some 200 years. Sheshonq also gained control of southern Egypt by placing his family members in important priestly positions. Libyan control began to erode as a rival dynasty in the delta arose in Leontopolis, and Kushites threatened from the south. Around 727 BC the Kushite king Piye invaded northward, seizing control of Thebes and eventually the Delta.

Egypt's far-reaching prestige declined considerably toward the end of the Third Intermediate Period. Its foreign allies had fallen under the Assyrian sphere of influence, and by 700 BC war between the two states became inevitable. Between 671 and 667 BC the Assyrians began their attack on Egypt. The reigns of both Taharqa and his successor, Tanutamun, were filled with constant conflict with the Assyrians, against whom Egypt enjoyed several victories. Ultimately, the Assyrians pushed the Kushites back into Nubia, occupied Memphis, and sacked the temples of Thebe

Late Period

With no permanent plans for conquest, the Assyrians left control of Egypt to a series of vassals who became known as the Saite kings of the Twenty-Sixth Dynasty. By 653 BC, the Saite king Psamtik I was able to oust the Assyrians with the help of Greek mercenaries, who were recruited to form Egypt's first navy. Greek influence expanded greatly as the city of Naukratis became the home of Greeks in the delta. The Saite kings based in the new capital of Sais witnessed a brief but spirited resurgence in the economy and culture, but in 525 BC, the powerful Persians, led by Cambyses II, began their conquest of Egypt, eventually capturing the pharaoh Psamtik III at the battle of Pelusium. Cambyses II then assumed the formal title of pharaoh, but ruled Egypt from his home of Susa, leaving Egypt under the control of a satrapy. A few successful revolts against the Persians marked the 5th century BC, but Egypt was never able to permanently overthrow the Persians.

Following its annexation by Persia, Egypt was joined with Cyprus and Phoenicia in the sixth satrapy of the Achaemenid Persian Empire. This first period of Persian rule over Egypt, also known as the Twenty-Seventh dynasty, ended in 402 BC, and from 380–343 BC the Thirtieth Dynasty ruled as the last native royal house of dynastic Egypt, which ended with the kingship of Nectanebo II. A brief restoration of Persian rule, sometimes known as the Thirty-First Dynasty, began in 343 BC, but shortly after, in 332 BC, the Persian ruler Mazaces handed Egypt over to Alexander the Great without a fight