The military history of Japan covers a vast time-period of over three millennia - from the Jōmon ( 1000 BC) to the present day. After a long period of clan warfare until the 12th century, there followed feudal wars that culminated in military governments known as the Shogunate. Japanese history records that a military class and the Shōgun ruled Japan for 676 years - from 1192 until 1868. The Shōgun and the samurai warriors stood near the apex of the Japanese social structure - only the aristocratic nobility nominally outranked them. The sakoku policy effectively closed Japan from foreign influences for 212 years - from 1641 to 1853. Feudal militarism transitioned to imperialism in the 19th century after the arrival of Admiral Perry in 1853 and the elevation of Emperor Meiji in 1868. Western colonial powers and their imperialist policies impacted on Japan's outlook and led to Japanese colonialism and rampant imperialism ( 1895-1945) until Japan's defeat in World War II. The 1947 Japanese Constitution prohibits Japan from offensively using war against other nations. This led to the establishment of the Japan Self-Defense Forces in 1954. The U.S.–Japan Alliance (1951 onwards) requires the United States of America to protect Japan and to conduct offensive duties. In 2015 the Constitution was reinterpreted to allow collective self-defense of Japan's allies.