The First Intermediate Period ushered in a time of political upheaval for about 150 years. Stronger Nile floods and stabilization of government, however, brought back renewed prosperity for the country in the Middle Kingdom "c". 2040 BC, reaching a peak during the reign of Pharaoh Amenemhat III. A second period of disunity heralded the arrival of the first foreign ruling dynasty in Egypt, that of the Semitic-speaking Hyksos. The Hyksos invaders took over much of Lower Egypt around 1650 BC and founded a new capital at Avaris. They were driven out by an Upper Egyptian force led by Ahmose I, who founded the Eighteenth Dynasty and relocated the capital from Memphis to Thebes.