Ideally the king of Egypt would be the son of the previous king. But when this was not possible, a woman was made the ruler. This most successful of female rulers was Hatshepsut who ruled Egypt for more than 20 very prosperous years.