At the Battle of Leipzig in 1813 Napoleon suffered a stunning defeat. One of his opponents on the battlefield was the Kingdom of Sweden. Having previously lost Finland to the czardom to the east, Sweden now wished to have Norway as a safeguard on its western border. Sweden's allies had therefore promised that it could have Norway as one of the spoils of war.
The allied victory at Leipzig was followed by diplomatic pressure in Copenhagen and a military attack on the dual monarchy, by way of Holstein. In January 1814, Danish King Fredrik VI surrendered, cut his ties with Napoleon, and handed Norway over to his Swedish rivals. Thus ended 434 years of union between Norway and Denmark.
The agreement between Denmark and its opponents contained political elements that were of major importance to Norway. The terms firmly established that Norway was again to take its place among the independent states, in union with Sweden. In a subsequent proclamation from Swedish King Carl XIII, it was stated that Norway was to have the status of an independent state, with its own free constitution, national representation, its own government and the right to levy taxes.
The Norwegians were not immediately amenable to the prospect of entering into a new union. The nephew of the Danish King, Prince Christian Frederik, was governor of Norway at the time. In keeping with an understanding with his uncle, the governor paved the way for a Norwegian revolt to prevent a Swedish takeover, and presumably also to secure a collaborative union once again between Denmark and Norway.
The governor's action led to the convening of an assembly whose purpose was to forge a constitution. They met at Eidsvoll, some 70 km north of Oslo, where they formally adopted a Norwegian Constitution on 17 May 1814, choosing Christian Frederik to be the Norwegian king. To this day, May 17 is celebrated as the Norwegian national day.
The victors of the Napoleonic Wars however, were unwilling to accept any deviation from the terms of the agreement. The Swedes exerted diplomatic pressure, and when this proved to be of no avail, they launched a military campaign of trained troops who rapidly subdued the Norwegians. In August an agreement was signed at Moss, south of Oslo, whereby the Swedes accepted the Norwegian Constitution signed at Eidsvoll, with the amendments made necessary by the union of the two kingdoms. King Christian Frederik relinquished his power on 10 October 1814, and left the country. Norway had entered into another union.