Prime Minister Spencer Perceval was assassinated in 1812 and was replaced by Lord Liverpool. Liverpool oversaw British victory in the Napoleonic Wars. The subsequent Congress of Vienna led to significant territorial gains for Hanover, which was upgraded from an electorate to a kingdom.