For over two centuries Japan had been closed to all foreigners until American warships forced Japan, in 1854, to open her ports to foreign trade.
The infuriated Japanese blamed the Tokugawa shogun - the military leader who had ruled Japan in place of the emperor - for the humiliation. (The Tokugawa line of shoguns had ruled Japan for 250 years and had enforced the seclusion of Japan.)
In 1867 the shogun was forced to resign and Emperor Mutsuhito announced that he had taken his traditional powers back from the shogun. The Emperor moved the capital from ancient Kyoto to Edo, which he renamed Tokyo and he assumed the name Meji meaning "enlightened rule".
During the Meji period (1868 -1912) the feudal system was abolished, and Western ideas and business contacts gained wide acceptance. The abolition of pensions to the samurai and of the ancient code of the sword led to the samurai uprising in 1877. Following its defeat the samurai caste disintegrated.
In the newly established parliament (1878) the military party began to reject European influence; it considered expansion to the continent of Asia more important than social and economic reforms. This led in 1894 to the Sino-Japanese war, when the superior Japanese forces conquered Dairen, Shantung, and Seoul. China ceded Formosa to the Japanese, and after the successful Russo-Japanese war Japan occupied Korea.