The earliest inhabitants that settled near the Nile River were hunters and gatherers that were drawn to the area because of the fertile soil along the banks. They settled into small villages and began the practice of farming along the Nile. As villages grew, these settlers realized the need to select a chief to make important decisions for the group and to settle disputes.
Over time, charismatic leaders would consolidate with other villages, sometimes through force. This process continued until Egypt was two separate kingdoms: Upper and Lower Egypt. Historians are unsure when Egypt moved from small egalitarian villages into the two separate larger kingdoms.
The unification of Egypt is also met with uncertainty. There are basically two accounts of the unification. One account by the ancient historian Manetho states that King Memes from Upper Egypt conquered Lower Egypt through force and unified the crowns. More contemporary scholarship points to a King Narmer who peacefully unified the two kingdoms. Some historians believe that Narmer and Menes are the same person. At any rate, by 3150 BC, the two kingdoms of Egypt were by all accounts one unified kingdom ruled by a powerful monarch known as the pharaoh.