From Emperor of Japan: Meiji and His World, 1852–1912, by Donald Keene (Columbia U. Press, 2005), Kindle pp. 573-574:
The proposal to create an alliance between England and Japan had its origins in Russian policy in the Far East. As noted earlier, after the conclusion of the Sino-Japanese War, the Japanese had been forced by three European powers to return the Liaotung Peninsula to China. However, Russia not long afterward leased this territory, signed a secret treaty with China, and began constructing a railway. The Russians now administered Port Arthur and Dairen and were steadily expanding their hold over northwestern China. Russian towns had been founded along the railway line. Other countries with interests in East Asia were concerned about Russia’s moves in Korea, and many believed that a clash between Russia and Japan was inevitable. However, the Japanese were by no means adequately prepared for such a conflict, and it was obvious that it would be extremely difficult for the country, unaided, to dislodge the Russians.
Japan had two possible courses of action. One (favored by Itō Hirobumi) was to reach an understanding with Russia whereby Manchuria would be yielded to the Russians. In return, Japanese predominance in Korea would be recognized. The other (favored by most other Japanese officials) was for Japan to act in concert with major European powers in order to contain Russia. It was unlikely that France would join an anti-Russian coalition, as France and Russia had recently concluded an alliance. Japan’s most likely partners were Germany and England, both of which were convinced that the Russians were infringing on their rights in East Asia. In April 1901, in conversation with Lansdowne, Hayashi had voiced the opinion that in order for there to be permanent peace in East Asia, a firm relationship between Japan and England was essential. Lansdowne agreed, but this was only the private opinion of the two men.
Even before this time, men in Japan and England had advocated such an alliance. In 1895 Fukuzawa Yukichi had written an editorial proposing an alliance; and in England Joseph Chamberlain, the minister for the colonies, had informally discussed the subject with the Japanese minister. In 1898 the Japanese government, about to end the occupation of Weihaiwei, consented to the British proposal to lease the city from the Chinese, adding that it hoped that the British would in return be sympathetic and offer help if Japan needed to take action to ensure its security or promote its interests. A pro-Japanese mood swept England in 1900 after the Japanese army rescued British subjects in Peking besieged by the Boxers. Hayashi Tadasu, who became minister to Great Britain that year, concluded that England was the only country with which Japan could form an alliance against Russia.