In any society, members of the community recognize they are required to restrain certain impulses in order to participate in the community. Every civilization has had some form of law which makes clear that the benefits of peaceful coexistence with one's clan, city, village, or tribe outweigh the gratification of selfish desires, and should one act on such desires at others' expense, there will be consequences. In ancient Egypt, the underlying form of the law which modified behavior was the central value of the entire culture: ma'at, (harmony and balance). Ma'at, personified as a goddess, came into being at the creation of the world and was the principle which allowed everything to function as it did in accordance with divine order.
This is a companion discussion topic for the original content at https://www.worldhistory.org/article/1104/police-in-ancient-egypt/.