Legal history or the history of law is the study of how law has evolved and why it changed. Legal history is closely connected to the development of civilisations and is set in the wider context of social history. Among certain jurists and historians of legal process, it has been seen as the recording of the evolution of laws and the technical explanation of how these laws have evolved with the view of better understanding the origins of various legal concepts; some consider it a branch of intellectual history. Twentieth century historians have viewed legal history in a more contextualised manner more in line with the thinking of social historians. They have looked at legal institutions as complex systems of rules, players and symbols and have seen these elements interact with society to change, adapt, resist or promote certain aspects of civil society. Such legal historians have tended to analyse case histories from the parameters of social science inquiry, using statistical methods, analysing class distinctions among litigants, petitioners and other players in various legal processes. By analysing case outcomes, transaction costs, number of settled cases they have begun an analysis of legal institutions, practices, procedures and briefs that give us a more complex picture of law and society than the study of jurisprudence, case law and civil codes can achieve.
Ancient Egyptian law, dating as far back as 3000 BC, had a civil code that was probably broken into twelve books. It was based on the concept of Ma'at, characterised by tradition, rhetorical speech, social equality and impartiality. By the 22nd century BC, Ur-Nammu, an ancient Sumerian ruler, formulated the first extant law code, consisting of casuistic statements ("if... then..."). Around 1760 BC, King Hammurabi further developed Babylonian law, by codifying and inscribing it in stone. Hammurabi placed several copies of his law code throughout the kingdom of Babylon as stelae, for the entire public to see; this became known as the Codex Hammurabi. The most intact copy of these stelae was discovered in the 19th century by British Assyriologists, and has since been fully transliterated and translated into various languages, including English, German and French. Ancient Greek has no word for "law" as an abstract concept, retaining instead the distinction between divine law (thémis), human decree (nomos) and custom (díkē). Yet Ancient Greek law contained major constitutional innovations in the development of democracy.