Britain had a functioning consular service in Japan from 1859 after the signing of the 1858 Anglo-Japanese Treaty of Amity and Commerce between James Bruce, 8th Earl of Elgin and the Tokugawa Shogunate until 1941 when Japan invaded British colonial empire and declared war on the United Kingdom.