The world's earliest legal code was probably that of the Mesopotamian King Hammurabi produced in around 1760 BCE. After the Bible, the most influential historical legal code is the Eastern Roman Emperor Justinian's Corpus Juris Civilis. This was compiled in the sixth century CE. It is the foundation of modern civil law codes. The emergence of nationalism and the decline of ecclesiastical authority after the Enlightenment inspired new civil codes based on Roman Law. The French Napoleonic Code was enacted in 1804. This inspired the German Bürgerliches Gesetzbuch (1900). The private law systems of Belgium, Italy, Holland, Poland, Portugal and Spain were modeled on the Napoleonic Code. Greece, Japan, South Korea, Thailand and the Ukraine based their legal codes on the Bürgerliches Gesetzbuch. European Union law is similarly codified. Louisiana also has a civil law system, based on the Napoleonic Code.
The United States Constitution (1787) is often identified as following in the tradition of the Magna Carta (1215) in England, limiting executive power. The common law system of case law and binding precedent in most states of the United States (except Louisiana) is derived from English common law. Despite the Ninth Century Peace of Wedmore that established Danelaw in England, before the Norman Conquest in 1066, justice in England was administered by Shire courts that applied local custom with respect to civil law, and canon law, as represented by the joint presidium of the Shire bishop and the sheriff. Trial was by jury in certain cases. William I's conquest did not bring with it the continental legal tradition, such as the French Salic law codified during the reign of the Frankish King Clovis I between 507 and 511 CE. Henry II of England (1133--1189) developed the practice of sending judges from the central Royal Court to hear disputes throughout the country. Henry established Royal Magistrate courts in which court officials decided local cases, in the name of the Crown. Henry declared law to be uniform throughout England rather than local or regional. Judges became bound to follow the decisions of earlier of higher judges (stare decisis). After American independence and the Declaration of Independence (1776) the United States retained the common law system. Common law legal systems also exist in Australia, Bangladesh, Cameroon, Canada, Ghana, India, Ireland, Malaysia, New Zealand, Pakistan, Singapore, South Africa, Sri Lanka and Zimbabwe.
The supremacy of law in Western legal systems is attributed by some, such as Harvard Law Professor Harold Berman (1918–2007), to the 11th-12th century separation of church and state. Early law was considered to have been a divine imperative. Pope Gregory VII (1028–1085), seeking to end interference in Papal appointments and in the wake of the Schism of the Eastern Orthodox Church, recognized the separate coexistence of church and state as a divine ordinance. In England, Henry II's Constitutions of Clarendon (1164) sought to reduce canonical power and the Pope's influence in England. These reforms were opposed by the Archbishop of Canterbury, Thomas Beckett (1118--1170), particularly in respect of clergy being tried in the Royal Court, as opposed to ecclesiastical courts. Beckett was murdered by Royalists.
The United States Constitution established the separation of the United States executive, legislature and judiciary. Legal formalists argue that if judges innovate new law, they violate the separation of powers. State law, such as the Massachusetts Constitution of 1780, also adopted the principle "the judicial shall never exercise the legislative and executive powers."
Legal realism was championed by 20th-century U.S. jurisprudence. Judges and law professors including Roscoe Pound and Justice Oliver Wendell Holmes considered that black-letter law seldom determined legal disputes. They also recognized that many judges interpret the law to achieve what they believe is mandated social justice (legal instrumentalism). Legal realism allowed judges to develop civil rights even when the legislature was slow to respond to the trend toward equality, such as ending segregation in the American education system (Brown v. Board of Education of Topeka, 347 U.S. 483, 1954). In England, judges were responsible for recognizing women's rights in the marital home with respect to ending the exception for the offence of marital rape in R v R  UKHL 12. Lord Keith of Kinkel stated, in his unanimously supported leading judgment, that the common law fiction of implied consent had no useful purpose to serve in the law of rape and had never been a true rule of English law. Legal realism looked behind civil codes, common law and formalist jurisprudence, recognizing the complexity of legal institutions and concepts in the evolution and development of law.