Raids and attacks by the Nubians from the South and Philistines from the East greatly weakened the New Kingdom leading to a period of decline that would continue for the next half a millennium. The civilization was rife with internal conflict and this was greatly compounded by low flooding of the Nile that further damaged its economy (a possible early impact of climate change). Religious relations between the various power brokers were never fully resolved after the Amarna Period which further strained society. Like future Ancient civilizations (the Romans in particular) the Egyptians were forced to use foreign mercenaries to defend their territories. Situations of dual loyalty were a natural consequence of such policy.
In 940 BCE Egyptian was conquered by the Libyans who founded their own dynasty(XXII). Two centuries later the Nubians overran Egypt establishing the XXVth dynasty. Both Assyria (652 BCE) and Persia (525 BCE) would later dominate Egypt as well. Other foreign powers that controlled Egypt over the next two and a half millennium include the Macedonians, Romans, Arabs, Turks and British.