They were given the domain as a march fief in 1590 by Toyotomi Hideyoshi, and charged with defending it, and by extension the whole of Japan, from the Ainu "barbarians" of the north.
The Matsumae official tried to explain that he had no authority to agree to trade on behalf of the shōgun and suggested that the Russians come back the following year.
In 1779, a massive earthquake struck Hokkaidō, and a forty-two-foot tsunami lifted the Russian ship[clarification needed] out of the sea, depositing it a quarter-mile inland.
At roughly the same time, in 1789, a Finnish professor, Erik Laxmann, of the Russian Academy of Sciences, came across several Japanese castaways in Irkutsk.
In 1791, she appointed the professor's son, Lt. Adam Laxman, to command a voyage to return these castaways to Japan, and to open discussions towards a trade agreement.
They were given a guest house near Matsumae Castle, and were, unusually, allowed to maintain their own customs: they did not deny their Christianity, remove their boots indoors or bow to the Shōgun's envoys.
The Japanese envoys gave them three swords and a hundred bags of rice, but also informed them that the Shōgun's rules remained unchangeable: foreigners could trade only at Nagasaki, and only if they came unarmed.
The envoys returned three days later with a document restating the rules regarding trade at Nagasaki and the laws against the practice of Christianity in Tokugawa Japan.
The Russian expedition led by Adam Johann von Krusenstern and Nikolai Rezanov stayed for six months in the port of Nagasaki in 1804–1805, failing to establish diplomatic and trade relations with Japan.