William IV (William Henry; 21 August 1765 – 20 June 1837) was King of the United Kingdom and King of Hanover from 26 June 1830 until his death. The third son of George III, William succeeded his elder brother George IV, as the last king and penultimate monarch of Britain's House of Hanover. William served in the Royal Navy in his youth and was, both during his reign and afterwards, nicknamed the "Sailor King". He served in North America and the Caribbean. Since his two older brothers died without leaving legitimate issue, he inherited the throne when he was 64 years old. His reign saw several reforms: the poor law was updated, child labour restricted, slavery abolished in nearly all of the British Empire, and the British electoral system refashioned by the Reform Act 1832. Although William did not engage in politics as much as his brother or his father, he was the last monarch to appoint a prime minister contrary to the will of Parliament. Through his brother Adolphus, the Viceroy of Hanover, he granted his German kingdom a short-lived liberal constitution. At the time of his death William had no surviving legitimate children, but he was survived by eight of the ten illegitimate children he had by the actress Dorothea Jordan, with whom he cohabited for twenty years. William was succeeded in the United Kingdom by his niece Victoria and in Hanover by his brother Ernest Augustus.