The Hyksos were a collection of West Semitic tribes who gained control of Egypt during the Second Intermediate Period, their name derived from the Egyptian word for "foreign ruler". They are believed to be the inspiration for the Israelites in the end of the Book of Genesis and the Book of Exodus, given the Hebrew origin in the Canaanite peoples, who were among the Hyksos rulers. They were known incorrectly as the "Shepherd Kings" by Josephus.
The Hyksos first migrated into Egypt around 1800 BCE during Egypt's 12th Dynasty. In the beginning of this dynasty two centuries earlier, Pharaohs Amenemhat I and Senusret I launched an aggressive expansion campaign on all of Egypt's borders closely followed by better diplomatic relations with tribal leaders to on the borders to guarantee the land would remain Egypt's. In this time, Egypt's land reached near the Levant, with ties being opened with Canaanite and Assyrian leaders. For unknown reasons, migration from around Canaan began and accelerated during the reigns of Amenemhat III and Amenemhat IV, with its people settling in the fertile wetlands of the Nile Delta. In the time of the succeeding Thirteenth Dynasty (1803 BCE - 1649 BCE), the state's power waned due to internal strife arising from a famine and the rise of new enemies from Nubia. Consequently a number of competing states emerged across Egypt, with the Hyksos establishing the rival Fourteenth Dynasty (c. 1725–1650 BCE), which was replaced with the new Fifteenth Dynasty (1650 - 1550 BCE) upon the defeat of the Thirteenth at the end of the civil war (a pretender Sixteenth Dynasty was briefly established in the far south of the country, finally destroyed after a seventy-year campaign by the Hyksos to capture their capital, Thebes). A later state, the Eighteenth Dynasty, launched another rebellion against the Fifteenth Dynasty and eventually succeeded. The first act upon conquering northern Egypt was the ethnic cleansing of the Semites, forcing them back to Canaan.