On 14 January 1814, at the Treaty of Kiel, the king of Denmark-Norway ceded Norway to the king of Sweden. The terms of the treaty provoked widespread opposition in Norway. The Norwegian vice-roy and heir to the throne of Denmark-Norway, Christian Frederik took the lead in a national uprising, assumed the title of regent, and convened a constitutional assembly at Eidsvoll. On 17 May 1814 the Constitution of Norway was signed by the assembly, and Christian Frederik was elected as king of independent Norway.