One factor contributing to the poor performance of the Swedish invasion force in Norway was that Russia at the same time invaded Finland on 21 February 1808. The two-front war proved disastrous for Sweden, and all of Finland was ceded to Russia at the Peace of Fredrikshamn on 17 September 1809. In the meantime, discontent with the conduct of the war led to the deposition of King Gustav IV on 13 May 1809. Prince Christian August, the enemy commander who had been promoted to viceroy of Norway in 1809, was chosen because the Swedish insurgents saw that his great popularity among the Norwegians might open the way for a union with Norway, to compensate for the loss of Finland. He was also held in high esteem because he had refrained from pursuing the retreating army of Sweden while that country was hard pressed by Russia in the Finnish War. Christian August was elected Crown Prince of Sweden on 29 December 1809 and left Norway on 7 January 1810. After his sudden death in May 1810, Sweden chose as his successor another enemy general, the French marshal Jean Baptiste Bernadotte, who was also seen as a gallant adversary and had proved his ability as an army commander.