In the beginning of the Napoleonic Wars, Denmark-Norway and the Kingdom of Sweden tried to maintain neutrality but soon became involved in the fighting, joining opposite camps. Swedish king Gustav IV Adolf entered an alliance with the United Kingdom of Great Britain and Ireland and the Russian Empire against Napoleon Bonaparte in 1805, and declared war on Napoleonic France. The United Kingdom, which had declared war on France in 1803, paid subsidies to Sweden. Before Gustav IV Adolf marched his forces out of Swedish Pomerania, a province long coveted by Prussia, he negotiated an agreement that Prussia would not attack it. Denmark remained neutral.