Sakoku (Japanese: 鎖国, literally "country in chains" or "lock up of country")[1] was the foreign policy of Japan under which no foreigner or Japanese could enter or leave the country on penalty of death. The policy was enacted by the Tokugawa Shogunate under Tokugawa Iemitsu through a number of edicts and policies from 1633-1639 and remained in effect until 1854 with the arrival of Commodore Matthew Perry and the opening of Japan. It was still illegal to leave Japan until the Meiji Restoration (1868).
But Japan was not completely isolated under the sakoku policy. Rather, it was a system in which strict regulations were applied to commerce and foreign relations by the shogunate.