The Tokugawa shogunate was forced to give up its national isolation policy when an American fleet led by Admiral Perry of US Navy came to Japan in 1853, resulting in the opening of Hakodate port. Accordingly, the Hakodate Magistrate’s Office, an administrative institution of the shogunate was established. With many foreign ships found in the waters surrounding Japan in those days, the Magistrate’s Office was a shogunate's diplomatic policy base, and administrative center of Ezo region.
The Magistrate’s Office was then located at the foot of Mt. Hakodate. Its location close to the port was regarded disadvantageous for defense, which led to the decision of moving the office further inland and the construction of the fort in order to guard the office. With information provided from a French battle ship anchoring at the port and others, the construction of the star-shaped (goryo) Western-style fort started in 1857. The Magistrate’s Office building was completed in 1864 and its functions moved into it.
A few years later, the shogunate decided to return its executive
authority to the Imperial court. In 1868, the Hakodate Magistrate’s
Office and the Goryokaku fort were taken over by the new Meiji
government. At the end of the year, however, some thousands of the
old shogunate escape force came and occupied the fort, having
Hakodate be the last battlefield in the war with the new government
forces. A French officer Jules Brunet, who had provided military
training for the shogunate, was with the old shogunate escape force.
In the following year, the old shogunate escape force
surrendered, and in 1871, the office building and almost all the
other ancillary buildings were dismantled by the new government. The
area was eventually turned into a public park in the 1910's and
designated as a special national historic site in 1952. Since then,
the fort has been a park with 1,600 cherry trees as well as
wisterias and azaleas in bloom from spring to early summer.
In 1985, to restore the original appearance of Goryokaku Fort, the city of Hakodate began to excavate the site, analyzing and examining old photographs, documents, and drawings. In 2010, the restoration of the Magistrate’s Office was completed with the help of artisans who gathered from all over the country, the building came back to our time for the first time in 140 years.