First treaty between the UK and Japan
The was the first treaty between Great Britain and Japan, then under the administration of the Tokugawa shogunate. Signed on October 14, 1854, it paralleled the Convention of Kanagawa, a similar agreement between Japan and the United States six months earlier which effectively ended Japan's 220-year-old policy of national seclusion ("sakoku"). As a result of the treaty, the ports of Nagasaki and Hakodate were opened to British vessels, and Britain was granted most favored nation status with other western powers.
The isolation of Japan.
Anglo-Japanese relations began in 1600 at the start of the Tokugawa shogunate with the arrival of William Adams, a seaman from Gillingham, Kent, who became an advisor to Tokugawa Ieyasu. He facilitated the creation of a British trading post at Hirado in 1613, led by English captain John Saris, who obtained a Red Seal permit giving "free licence to abide, buy, sell and barter" in Japan. However, during the ten year activity of the company between 1613 and 1623, apart from the first ship ("Clove" in 1613), only three other English ships brought cargoes directly from London to Japan. The British withdrew in 1623 without seeking permission from the Japanese, and in 1639, the Tokugawa shogunate announced a policy of isolating the country from outside influences with foreign trade to be maintained only with the Dutch and the Chinese exclusively at Nagasaki under a strict government monopoly.
The isolation policy was challenged several times by the British, most notably in 1673, when an English ship named "Returner" visited Nagasaki harbor, and was refused permission to renew trading relations, and in 1808, when the warship entered Nagasaki during the Napoleonic War to attack Dutch shipping and threatened to destroy the town unless it was provided with supplies.
By the early nineteenth century, the policy of isolation was increasingly under challenge. In 1844, King William II of the Netherlands sent a letter urging Japan to end the isolation policy on its own before change would be forced from the outside. In 1852, United States Navy Commodore Matthew Perry was sent with a fleet of warships by American President Millard Fillmore to force the opening of Japanese ports to American trade, through the use of gunboat diplomacy if necessary. There was considerable internal debate in Japan on how best to meet this potential threat to Japan's economic and political sovereignty, but after Perry threatened to continue directly on to Edo, the nation's capital and to burn it to the ground if necessary, he was allowed to land at nearby Kurihama on July 14 and to deliver his letter. The visit resulted in the Convention of Kanagawa signed on March 31, 1854, which opened the ports of Shimoda and Hakodate to American vessels, ensured the safety of American castaways and established the position of an American consul in Japan.
The Stirling expedition.
In early August 1853, Russian admiral Yevfimy Putyatin arrived at Nagasaki with a fleet of four vessels, just one month after the visit to Perry to Uraga in an attempt to force the opening of Japan. At the time, Russia was at war with Great Britain (the Crimean War), and alarmed at the possibility that Russia would obtain the upper hand in Japan, Royal Navy vice admiral Sir James Stirling, commander of the East Indies and China Station led a fleet of British warships to Nagasaki on September 7, 1854. Stirling's flagship was the sail frigate , accompanied by screw corvette and paddle sloops and .
Stirling was not actually authorized to negotiate a treaty, and the signing of the convention came about due to a series of miscommunications. Stirling initially had two objectives: to find and attack the Russian fleet even if it were in Japanese waters, and to reaffirm Japan's neutrality in the conflict. To this end, he carried a copy of the British declaration of war on Russia, signed by Queen Victoria. However, the Tokugawa shogunate, already cautious of the British in light of the Opium War and recent negotiations with the Americans, assumed that the British were in Nagasaki to demand similar concessions. Stirling brought his own interpreter, Yamamoto Otokichi a Japanese castaway of limited education, and also relied on the assistance of Jan Hendrik Donker Curtius, the senior Dutch East Indies Company factor at Nagasaki. The Japanese were served by Nishi Kichibei, a Dutch language interpreter who had a predilection for altering the tone or content of what he was interpreting.
Specifically, Sterling sought confirmation that Japanese ports would continue to be denied to Russian vessels, at least for the duration of the war, even if this meant that damaged British ships would also be denied permission to dock in Japan for repairs and re-provision.
Assuming that Stirling was in Nagasaki to demand the same concessions as Perry, during discussions in Edo, officials in the Tokugawa shogunate agreed that forming an agreement with the British was not only unavoidable, but that the British could be a powerful force to offset Russian designs on the Kuril islands. Consequently, Stirling was received by the "Nagasaki bugyō", Mizuno Tadanori, who had originally been sent by the Tokugawa shogunate to Nagasaki to negotiate with Perry, and who was familiar with the treaty which had already been signed with the Americans. Mizuno's preconceptions on the British intentions were bolstered by Nishi's mistranslations, and over the course of three sessions of negotiations (October 4, October 9 and October 14) the outline of a treaty was drafted, which Mizuno, together with "metsuke" Nagai Naoyuki signed on October 14.
Anglo-Japanese Friendship Treaty (1854).
The "Anglo-Japanese Friendship Treaty" has seven articles: 
Article Six, stipulated that the terms of the treaty were to be ratified by Her Majesty, the Queen of Great Britain and the "His Highness the Emperor of Japan" within 12 months. At the time, "shōgun" Tokugawa Iesada was the de facto ruler of Japan; for the Emperor to interact in any way with foreigners was out of the question. Stirling concluded the treaty with representatives of the shogun, and the text was endorsed subsequently, albeit reluctantly, by Emperor Kōmei.
Consequences of the treaty.
In the short-term, the Japanese were satisfied with the agreement, which gave no concessions which had not already been granted to the Americans, and which at least temporarily averted the possibility of immediate military confrontation. 
However, on the British side, Stirling came under immediate criticism as the treaty made no provision for formal trade relations with Japan, and the question of extraterritoriality for foreigners was vaguely worded. Furthermore, the final clause in the treaty seemed to preclude the possibility of further negotiations. The only opening left to Great Britain was an informal promise that he would send a steam yacht as a present for the Shogun of Japan.
Lord Elgin was sent by Queen Victoria in 1858 to negotiate the trade agreement, using the delivery of the yacht as an excuse to start discussions. This led to the Anglo-Japanese Treaty of Amity and Commerce of 1858, which allowed the establishment of foreign concessions, extraterritoriality for foreigners, and minimal import taxes for foreign goods. The Japanese chafed under the "unequal treaty system" which characterized Asian and Western relations during this period. The Anglo-Japanese Friendship Treaty was also followed by similar agreements with the Russians (Treaty of Shimoda, 7 February 1855).
Notes.
 ;templatestyles src="Reflist/styles.css" / ;