A fear of influences from revolutionary France dominated the Swedish government during the last decade of the 18th century and the first of the 19th. These fears were reflected in major economies in public finances, the legislation of land reforms, and the censoring of French literature. Gustav IV (ruled 1792-1809), unlike his father, Gustav III, was pious and superstitious. He considered events in France to be insults to moral order. A deep aversion toward the revolutionaries and Napoleon characterized his foreign policy. Of decisive importance was his resolution in 1805 to join the coalition against France. When France and Russia signed the Treaty of Tilsit in 1807, Gustav stubbornly accepted war, even with Russia. Denmark, which had sided with France in October 1807, declared war against Sweden in 1808. England, at the moment busy in Spain, could offer little help. Sweden thus became politically isolated, with enemies in the east, south, and west. The Swedish army defended Finland poorly, reaching its nadir when the strong fortress of Sveaborg near Helsingfors was handed over to the Russians by treason. The Russians advanced as far as Umeå in Sweden.
In March 1809 Gustav IV was deposed by a group of high officials and officers. More than anything, a widespread longing for a quick and cheap peace brought the men of 1809 to power, but they were unable to save Finland. In September 1809 a bitter peace was made at Fredrikshamn, in which Sweden surrendered Finland and the Åland Islands (northeast of Stockholm) to Russia. A new constitution was promulgated, embodying the principle of separation of powers. The division of the Diet in four estates remained. Charles XIII (ruled 1809-18), the uncle of Gustav IV, was elected king. The fact that he was senile and childless opened the question of succession to the throne.
With the consent of Denmark, the commander in chief of the Norwegian army, Christian August (at the moment waging war against Sweden), was elected crown prince and took the name Charles August. Behind this decision were thoughts of a Scandinavian confederation. This solution was cherished by Denmark and even by Napoleon.