The law of Japan is primarily based on legal codes and statutes, with precedents also playing an important role. Japan has a civil law legal system with six legal codes, which were greatly influenced by Germany, to a lesser extent by France, and also adapted to Japanese circumstances. The Japanese Constitution enacted after World War II is the supreme law in Japan. An independent judiciary has the power to review laws and government acts for constitutionality.

Historical developments Early Japan The early laws of Japan are believed to have been heavily influenced by Chinese law.Malcolm D. Evans. International Law. p. 49. Oxford, 2003. . Little is known about Japanese law prior to the seventh century, when the Ritsuryō was developed and codified. Before Chinese characters were adopted and adapted by the Japanese, the Japanese had no known writing system with which to record their history. Chinese characters were known to the Japanese in earlier centuries, but the process of assimilation of these characters into their indigenous language system took place in the third century. This was due to the willingness of the Japanese to borrow aspects of the culture of continental civilisations, which was achieved mainly via adjacent countries such as the Korean kingdoms rather than directly from the Chinese mainland empires.This may be shown by reference to some epochal events in Japanese relations with three Korean countries during this period: with Shilla in 205 AD, Paekche in 2016 AD and Kogryo, bordering upon North China, in 297 AD as cited by Masaji Chiba, Japan Poh-Ling Tan, (ed), Asian Legal Systems, Butterworths, London, 1997 at 89–90.

Two of the most significant systems of human philosophy and religion, Confucianism (China) and Buddhism (India), were officially transplanted in 284–285 and 522 AD respectively, and became deeply acculturated into indigenous Japanese thought and ethics.Masaji Chiba, Japan Poh-Ling Tan, (ed), Asian Legal Systems, Butterworths, London, 1997 at 90. David and Zweigert and Kotz argue that the old Chinese doctrines of Confucius, which emphasize social/group/community harmony rather than individual interests, have been very influential in the Japanese society, with the consequence that individuals tend to avoid litigation in favour of compromise and conciliation.K Zweigert and H Kotz, Introduction to Comparative Law (2nd ed, Vol 1, Oxford, Clarendon press, 1987), pp. 361, 370–371; R. David and J. E. C. Brierley, Major Legal Systems in the World Today, An Introduction to the Comparative Study of Law (2nd ed, London, Stevens and Sons, 1978), pp. 479, 500.

It is theorized by some that the flow of immigrants was accelerated by both internal and external circumstances. The external factors were the continuing political instability and turmoil in Korea, as well as the struggle for central hegemony amongst the Chinese dynasties, kingdoms, warlords, invasions and other quarrels. These disturbances produced a large number of refugees who were exiled or forced to escape from their homelands. Immigrants to Japan may have included privileged classes, such as experienced officials and excellent technicians who were hired in the Japanese court, and were included in the official rank system which had been introduced by the immigrants themselves. It is conceivable – but unknown – that other legal institutions were also introduced, although partially rather than systematically, and this was probably the first transplantation of foreign law to Japan.However, Japanese legal and general historians have not overtly affirmed or denied this for two reasons: first, because there are no written records left and, second, because Japanese official history tended to devaluate, or even deny, and Korean influence, cited in Masaji Chiba, Japan Poh-Ling Tan, (ed), Asian Legal Systems, Butterworths, London, 1997 at 90.

During these periods, Japanese law was unwritten and immature, and thus was far from comprising any official legal system. Nonetheless, Japanese society could not have functioned without some sort of law, however unofficial. Glimpses of the law regulating people's social lives may be guessed at by considering the few contemporary general descriptions in Chinese historical books. The most noted of these is The Record on the Men of Wa, which was found in the Wei History, describing the Japanese state called Yamatai (or Yamato) ruled by the Queen Himiko in the second and third centuries. According to this account, Japanese indigenous law was based on the clan system, with each clan forming a collective unit of Japanese society. A clan comprised extended families and was controlled by its chief, who protected the rights of the members and enforced their duties with occasional punishments for crimes. The law of the court organised the clan chiefs into an effective power structure, in order to control the whole of society through the clan system. The form of these laws is not clearly known, but they may be characterised as indigenous and unofficial, as official power can rarely be identified.Masaji Chiba, Japan Poh-Ling Tan, (ed), Asian Legal Systems, Butterworths, London, 1997 at 91.

In this period, a more powerful polity and a more developed legal system than the unofficial clan law of the struggling clan chiefs was required effectively to govern the society as a whole. Yamatai must have been the first central government which succeeded in securing the required power through the leadership of Queen Himiko, who was reputed to be a shaman. This leads to the assertion that Yamatai had its own primitive system of law, perhaps court law, which enabled it to maintain government over competing clan laws. As a result, the whole legal system formed a primitive legal pluralism of court law and clan law. It can also be asserted that this whole legal system was ideologically founded on the indigenous postulate which adhered to the shamanistic religio-political belief in polytheistic gods and which was called kamiTranslation of "kami" = gods in Shintoism, not only enshrined in Jinja (enshrinement of Shinto gods, worshiped by any group of small local fraternities, local communities or associated believers from different localities) but also deified as governing human affairs and natural occurrences, as cited by Masaji Chiba, "Japan" Poh-Ling Tan, (ed), Asian Legal Systems, Butterworths, London, 1997 at 118. and later developed into Shintoism.Masaji Chiba, "Japan" Poh-Ling Tan, (ed), Asian Legal Systems, Butterworths, London, 1997 at 91.

Two qualifications can be added to these assertions. First, some Korean law must have been transplanted, albeit unsystematically; this can be seen by the rank system in court law and the local customs among settled immigrants. Second, official law was not clearly distinguished from unofficial law; this was due to the lack of written formalities, although court law was gradually emerging into a formal state law as far as central government was concerned. For these reasons, it cannot be denied that a primitive legal pluralism had developed based on court and clan law, partially with Korean law and overwhelmingly with indigenous law. These traits of legal pluralism, however primitive, were the prototype of the Japanese legal system which developed in later periods into more organised legal pluralisms.

Ritsuryō system

In 604, Prince Shotoku established the Seventeenth-article Constitution, which differed from modern constitutions in that it was also moral code for the bureaucracy and aristocracy. While it was influenced by Buddhism, it also showed a desire to establish a political system centered on the emperor, with the help of a coalition of noble families. Nevertheless, there are doubts that the document was fabricated later.

Japan began to dispatch envoys to China's Sui Dynasty in 607. Later, in 630, the first Japanese envoy to the Tang Dynasty was dispatched. The envoys learned of Tang Dynasty's laws, as a mechanism to support China's centralized state. Based on the Tang code, various systems of law, known as the Ritsuryō (律令), were enacted in Japan, especially during the Taika Reform.Hane, Mikiso; Perez, Louis G. (2014). Premodern Japan: a Historical Survey. (Second edition ed.). Boulder, CO. . Ritsu (律) is the equivalent of today's criminal law, while ryō (令) provides for administrative organization, taxation, and corvée (the people's labor obligations), similar to today's administrative law. Other provisions correspond to modern family law and procedural law. Ritsuryō was strongly influenced by Confucian ethics. Unlike Roman law, there was no concept of private law and there was no direct mentioning of contracts and other private law concepts.

One major reform on the law was the Taihō (Great Law) Code, promulgated in 702. Within the central government, the law codes established offices of the Daijō daijin (chancellor), who presided over the Dajōkan (Grand Council of State), which included the Minister of the Left, the Minister of the Right, eight central government ministries, and a prestigious Ministry of Deities. These ritsuryō positions would be mostly preserved until the Meiji Restoration, although substantive power would for a long time fall to the bakufu (shogunate) established by the samurai. Locally, Japan was reorganized into 66 imperial provinces and 592 counties, with appointed governors.

Laws under the shogunates Beginning in the 9th century, the Ritsuryo system began to break down. As the power of the manor lords (荘園領主) grew stronger, the manor lords' estate laws (honjohō 本所法) began to develop. Furthermore, as the power of the samurai rose, samurai laws (武家法 bukehō) came to be established. In the early Kamakura period, the power of the imperial court in Kyoto remained strong, and a dual legal order existed with samurai laws and Kuge laws (公家法 kugehō), the latter having developed on the basis of old Ritsuryo laws.

In 1232, Hojo Yasutoki of the Kamakura Shogunate established the Goseibai Shikimoku, a body of samurai laws consisting of precedents, reasons and customs in samurai society from the time of Minamoto no Yoritomo, and which clarified the standards for judging the settlement of disputes between gokenin and between gokenin and manor lords. It was the first systematic code for the samurai class. Later, the Ashikaga shogunate more or less adopted the Goseibai Shikimoku as well.

In the Sengoku period (1467–1615), the daimyos developed feudal laws (bunkokuhō 分国法) in order to establish order in their respective territories. Most such laws sought to improve the military and economic power of the warring lords, including instituting the rakuichi rakuza (楽市・楽座) policy, which dissolved guilds and allowed some free marketplaces, and the principle of kenka ryōseibai (喧嘩両成敗), which punished both sides involved in brawls.

In the Edo period (1603–1868), the Tokugawa shogunate established the bakuhan taisei (幕藩体制), a feudal political system. The shogunate also promulgated laws and collection of precedents, such as the Laws for the Military Houses (武家諸法度 Buke shohatto) and the Kujikata Osadamegaki (公事方御定書). It also issued the Laws for the Imperial and Court Officials (禁中並公家諸法度 kinchū narabini kuge shohatto), which set out the relationship between the shogunate, the imperial family and the kuge, and the Laws on Religious Establishments (寺院諸法度 jiin shohatto).