After the Finnish War, which ended when Sweden ceded Finland to Imperial Russia at the Treaty of Fredrikshamn in 1809, Turku became briefly the official capital, but soon lost the status to Helsinki, as Emperor Alexander I felt that Turku was too far from Russia and too aligned with Sweden to serve as the capital of the Grand Duchy of Finland. The change officially took place in 1812. The government offices that remained in Turku were finally moved to the new capital after the Great Fire of Turku, which destroyed a large portion of the city in 1827. After the fire, a new and safer city plan was drawn up by German architect Carl Ludvig Engel, who had also designed the new capital, Helsinki. Turku remained the largest city in Finland for another twenty years.