power by passing legislation. The royal prerogative includes the powers to appoint and dismiss ministers, regulate the civil service, issue passports, declare war, make peace, direct the actions of the military, and negotiate and ratify treaties, alliances, and international agreements. However, a treaty cannot alter the domestic laws of the United Kingdom; an Act of Parliament is necessary in such cases. The sovereign is the Head of the Armed Forces (the Royal Navy, the British Army, and the Royal Air Force), and accredits British High Commissioners and ambassadors, and receives heads of missions from foreign states. Appointment of the prime minister The sovereign has the power to appoint the prime minister. In accordance with unwritten constitutional conventions, the monarch appoints the individual who commands the support of the House of Commons, usually the leader of the party or coalition that has a majority in that House. The prime minister takes office by attending the monarch in a private audience, and after "kissing hands" that appointment is immediately effective without any other formality or instrument. The sovereign also has the power to dismiss the prime minister, but the last time this power was exercised was in 1834, when William IV dismissed Lord Melbourne; since then, prime ministers have only left office upon their resignation, which they are expected to offer to the monarch upon losing their majority in the House of Commons. While the sovereign also appoints and may dismiss every other Minister of the Crown, by convention they do so only on the recommendation of the prime minister. It is therefore the prime minister who controls the composition of the government. In practice, the prime minister will request a member of the government resign in preference to advising the monarch to dismiss them; such ministers are euphemistically described as "leaving the government". In a hung parliament where no party or coalition holds a majority, the monarch has an increased degree of latitude in choosing the individual likely to command the most support, though it would usually be the leader of the largest party. Since 1945, there have only been three hung parliaments. The first followed the February 1974 general election when Harold Wilson was appointed Prime Minister after Edward Heath resigned following his failure to form a coalition. Although Wilson's Labour Party did not have a majority, they were the largest party. The second followed the May 2010 general election,