Soniryo was a division of the Japanese ritsuryo code. It consisted of 27 articles in the Yoro ritsuryo code (code promulgated in the Yoro period). It was a law applicable to priests and nuns as well as the shami (novice priests) and the shamini (novice nuns) who were officially certified by the state (Note that it did not govern Buddhism itself). In the Chinese (Tang) ritsuryo that shaped the Japanese counterpart, however, the Soniryo belonged to the 'Dosokyaku' (code for priests) that covered Taoists in Taoism. While the Japanese version excluded the Taoistic elements which were not practiced in the country, it incorporated the rest without distinguishing the 'ritsu' elements that had the nature of criminal code from the 'ryo' portion that pertained to administrative law. It therefore had a complex structure in which despite being an administrative law, it also comprised the provisions for criminal punishment.
It has been assumed that the Soniryo was first included in the Taiho ritsuryo code as there is no trace of it in the Asukakiyomihara-ryo (the legal code of ancient Japan). "Shoku Nihongi" (The Chronicle of Japan Continued) describes how MICHI no Obitona listened to a lecture on the Soniryo at the Daian-ji Temple on July 14, 701 before the Taiho code came into effect. The Taiho code whose details are unknown has been said it was not radically different from the Yoro code. In 806 Chufun who was a shosozu (junior prelate) addressed to the emperor for the lifting of the Soniryo. Consequently it became possible to apply the Buddhist precepts to the cases other than murder and theft. In 812 the Soniryo was reinstituted.
The Soniryo was essentially about penalties for subversive criminal acts by priests and nuns, the self-governing control of temples, priests and nuns by the members of the Sogo (a priest of a managerial post) who were appointed by the state, prohibitions against shidoso (lay priests), the indoctrination of the populace, and the regulation of ascetic training in the mountains and begging. For the subversive criminal acts by priests and nuns, commutation called genzoku (laicization, a punishment equivalent to or heavier than imprisonment) or kushi (penal servitude equivalent to flogging or whipping) was adopted and gozai (five criminal punishments) which were the criminal charges in the ritsuryo system were not applied. However, those who interpreted astronomical events as good or bad omens, who deceived farmers by criticizing the state or emperor, who studied forbidden books (like strategy books), or who committed murder, rape or theft were punished according to the ritsuryo code after they were forcefully laicized.
According to a generally accepted theory, the Soniryo was rigorously enforced as the law for maintaining the nation protection thought. While it gave the state more controlling power, it held the Sogo in high regard, allowing the religious community to enjoy certain autonomy and permitting leniency to priests and nuns. It was steeped with protective attitudes towards religious institutions, priests and nuns. As Kazuhiko YOSHIDA (a historian) has pointed out, those who were punished for lay priesthood were limited to those who pretended to be priests to evade taxation. Lay priests who observed the religious precepts were encouraged to enter the priesthood so that they could be integrated into the established order. Such was a strategy that the state took (as was the case with Kukai). In 717, (Gyoki) was condemned by the imperial edict and was then punished for indoctrinating the populace and criticizing the government. Yet there is no account in which even this Gyoki executed genzoku. In 846 the priest Zengai filed a suit concerning the violation of the Soniryo, which developed into a political issue. Thus, the Soniryo was not so strictly enforced as generally assumed. This can be likewise indicated by the fact that there are Buddhist remains that had no bearing with the state or state-sponsored temples all over the country. After the 10th century when the ritsuryo system collapsed, the provisions of the Soniryo increasingly became nominal.