Sakoku (Japanese: 鎖国, literally "country in chains" or "lock up of country") 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).