When Commodore Matthew Perry and the American black ships showed up in Edo Harbor, their appearance and subsequent "opening" of Japan set off an unpredictable chain of events in Tokugawa Japan, chief among them a civil war that broke out fifteen years later: the Boshin War.
The Boshin War lasted only two years, between 1868 and 1869, and pitted Japanese samurai and nobles against the reigning Tokugawa regime, wherein the samurai wanted to overthrow the shogun and return political power to the emperor.
Ultimately, t he militant pro-emperor samurai of Satsuma and Choshu convinced the emperor to issue a decree dissolving the House of Tokugawa, a potentially fatal blow to the former shoguns' family.
First Signs of the War
On January 27, 1868, the shogunate's army - numbering over 15,000 and primarily comprised of traditional samurai - attacked the troops of Satsuma and Choshu at the southern entrance to Kyoto, the imperial capital.
Choshu and Satsuma had only 5,000 troops in the fight, but they had modern weaponry including rifles, howitzers, and even Gatling guns. When the pro-imperial troops won the two-day-long fight, several important daimyo switched their allegiance from the shogun to the emperor.
On February 7, the former shogun Tokugawa Yoshinobu left Osaka and withdrew to his own capital city of Edo (Tokyo). Discouraged by his flight, the shogunal forces gave up their defense of Osaka Castle, which fell to imperial forces the following day.
In another blow to the shogun, foreign ministers from the western powers decided in early February to recognize the emperor's government as the rightful government of Japan. However, this did not prevent samurai on the imperial side from attacking foreigners in several separate incidents as anti-foreigner sentiment was running very high.
A New Empire is Born
Saigo Takamori, later famed as the "Last Samurai," led the emperor's troops across Japan to encircle Edo in May of 1869 and the shogun's capital city surrendered unconditionally a short time later.
Despite this apparently quick defeat of the shogunal forces, the commander of the shogun's navy refused to surrender eight of his ships, instead heading north, hoping to join forces with the Aizu clan's samurai and other northern domain warriors, who were still loyal to the shogunal government.
The Northern Coalition was valiant but relied on traditional fighting methods and weaponry. It took the well-armed imperial troops from May to November of 1869 to finally defeat the stubborn northern resistance, but on November 6, the last Aizu samurai surrendered.
Two weeks earlier, the Meiji Period had officially begun, and the former shogunal capital at Edo was renamed Tokyo, meaning "eastern capital."
Fallout and Consequences
Although the Boshin War was over, fallout from this series of events continued. Die-hards from the Northern Coalition, as well as a few French military advisers, tried to set up a separate Ezo Republic on the northern island of Hokkaido, but the short-lived republic surrendered and winked out of existence on June 27, 1869.
In an interesting twist, Saigo Takamori of the very pro-Meiji Satsuma Domain later regretted his role in the Meiji Restoration. He ended up being swept into a leadership role in the doomed Satsuma Rebellion, which ended in 1877 with his death.