In 1966, Menzies retired and was replaced as prime minister by Harold Holt. McMahon then succeeded Holt as deputy leader of the Liberal Party. He was appointed Treasurer in the Holt Government, and over the following three years oversaw a large reduction in the national deficit. After Holt's death in 1967, McMahon wished to contest the Liberal leadership but had his candidacy vetoed by John McEwen, the leader of the Country Party. The new prime minister was John Gorton. McMahon initially continued on as Treasurer in the Gorton Government, but in 1969 was demoted to Minister for External Affairs after an unsuccessful challenge for the leadership. He eventually forced Gorton's resignation in early 1971, winning a vote against Billy Snedden.