Why the initially anti-foreign attitude of the Japanese changed to the acceptance of the West in the 1860s.

Anti-foreign attitude -- the Japanese reaction to the coming of the West was initially anti-foreign. Many reasons accounted for this attitude. First, the more than two centuries of seclusion had nursed a sentiment of suspicion of anything foreign, especially among the conservatives. Second, the coming of the West was accompanied by a military threat. In other words, Japan was opened by force and had to accept unequal treaties. This injured the pride of many Japanese, particularly the southern daimyo and samurai. Third, as western impact intensified under the cover of treaty terms, the livelihood of many ordinary Japanese was worsened. Fourth, most Japanese leaders, ranging from bakufu officials to daimyo and samurai, were ignorant of the strength of the West. Some learnt of the tragedy of China in the Opium War and the Arrow War, and they were afraid that the same fate would fall on Japan should the country be opened a little bit. Thus, Tokugawa Nariaki, the lord of Mito, told the government that the foreigners would end up swallowing up Japan. "If we fail to drive them off now," he said, "we shall never have another chance." Many samurai were enthusiastic with the defense measures which had been ordered by the daimyo. A war, they thought, would probably be fought between Japan and the barbarians soon.

Joi movement -- such anti-foreign sentiment expressed itself in the joi movement in the closing years of the shogunate. Emperor Komei was unwilling to ratify the bakufu's draft treaty with Townsend Harris in 1858. Only under pressure did he agree to a decree which did not specifially approve the draft treaty, but recognized that decisions on foreign policy were the bakufu's responsibility. Later in 1862, Komei demanded the shogunate to take action to expel the foreigners by mid-1863. Since the shogunate failed to act, both Satsuma and Choshu took the lead. In Satsuma, Charles Richardson (an Englishman) was killed by the samurai in 1862. Fighting with British forces soon spread to Kagoshima Bay. In Choshu, she opened fire on foreign vessels in the Shimonoseki Strait in 1863. Such actions were hailed by patriots as a victory over both the foreigners and Edo. They intensified those isolated attacks and stoning of foreigners everywhere in Japan. It was a period of intense emotionalism, and the slogan "sonno-joi" became the loudest.
Paradoxically, the years following were a period of acceptance of the West. There was a sudden change of attitude towards foreigners. Why did this happen is a matter of assumptions and needs explanation.

Changing attitude -- sense of realism -- in response to the actions of Satsuma and Choshu, the West retaliated. The British ordered the bombardment of Kagoshima. The other western powers (Dutch, French) assembled a squadron and blockaded the Strait of Shimonoseki for more than a year. An allied fleet also demonstrated their strength at the Bay of Osaka. Finally, they got apologies and indemnities from the Japanese in return for their retreat.
How influential these events were on the attitude of the Japanese towards the West is not easy to measure. Nevertheless, it did give the anti-foreign clans a valuable lesson. The more realistic daimyo and samurai leaders came to realize that the foreigners were yet too strong to be defeated and driven out. Acceptance of their presence in Japan was the only alternative.
The misfortune that fell on China (the Qing Dynasty) between 1840 and 1860 served to be another lesson to the Japanese. The Chinese, after their defeat in the Opium War, refused to abide by the 1840s treaties. Together with other unpleasant incidents with the West, there led to the Anglo-French invasion of Peking in 1860, and China had to accept even harsher treaty terms. This objective lesson gave the Japanese an example that blind resistance to the West would only bring great disasters to their mother country. It might therefore be wiser to accommodate with the West.
The more far-sighted ones went further. They came to think that the technology of the westerners could in fact be used to serve Japanese purposes and ends. For instance, they could borrow western military technology to overthrow the bakufu in the first instance. Later perhaps, they could use the same technology to drive out the barbarians. Small wonder then, it was both Satsuma and Choshu that soon came to terms with the West because they themselves had been the unwilling pupils of western military strength. Their experience with western technology and military technique persuaded many that Japan had a lot to learn from the West. More fortunately still, these two hans were controlled by able and far-sighted young samurai who rose to power in the period of reforms in the 1840s.

Tradition of culture borrowing -- Another important factor was the tradition of learning and culture borrowing from others in Japan. In the earlier centuries, the Japanese had learnt from China. Now, in the mid-l9th century, they were willing to learn from the West in order to escape colonization.

Growing influence of the Kaikokusha -- in the midst of such changing attitude, the influence of the kaikokusha grew rapidly. These kaikoku scholars had been advocating the acceptance of the West since the early 19th century. They realized that it was necessary to know more about the conditions of the West. One important figure of this school of thought was Sakuma Shozan (1811-64) who advocated "Eastern ethics, Western science" as the solution to the acceptance of the West without betraying Japan's tradition. Again, it is difficult to measure the extent of the influence the scholars of this sort had on the people. Yet, it will not be an exaggeration if one is to say that ideas of these scholars had a wider acceptance than before. Their philosophies and ideas shocked many Japanese from their self-containment and complacency.

Conclusion -- for these reasons ,the initially anti-foreign attitude of the Japanese changed to the acceptance of the West. Before the collapse of the shogunate, the "joi" cry was still raised, but it was largely an argument to embarrass the bakufu. After the Meiji Restoration, "joi" died down. In fact, the new government began to encourage the adoption of western ways. To the Meiji leaders, they were only proposing a wiser and a more feasible approach to the foreign menace. It was obvious that Japan's only defense against the West laid in the creation of "a rich country and a strong army" which was to be achieved through westernization.