Ancient Egypt developed along the fertile banks of the Nile River. The annual flooding of the Nile provided rich soil and water for irrigation, allowing the Egyptians to develop a prosperous agricultural society isolated by deserts. Key periods of Egyptian history include the Old Kingdom, Middle Kingdom, and New Kingdom, during which powerful pharaohs ruled as absolute gods and built pyramids, temples, and expanded Egypt's empire. Egyptian civilization declined when outside groups like the Hyksos and Nubians invaded and conquered parts of Egypt.