Upper and Lower Egypt are reunited by Theban king Nebhepetre Mentuhotep II who establishes the capital at Thebes, then Itj-tawy. Egypt is briefly ruled by competing dynasties from western Asia and its environs. Reunification occurs again under Ahmose I and a time of economic and artistic prosperity ensues. Hatshepsut, the most powerful female ruler of pharaonic history, builds her unique funerary temple in western Thebes. After the reign of Ramesses III, Egypt’s power gradually declines, leading to the Third Intermediate Period.