Despite leading in opinion polls, Labour unexpectedly lost the 1970 election to Edward Heath's Conservatives. Wilson chose to remain in the Labour leadership, and spent four years back in the role of Leader of the Opposition, before leading Labour through the February 1974 election, which resulted in a hung parliament. Although the Conservatives had won more votes than Labour, after Heath's talks with the Liberals failed Wilson was able to broker an agreement with the Liberal Party to be appointed prime minister for a second time, now as leader of a minority government; Wilson called a snap election in October 1974, which gave Labour a small victory. During his second term as prime minister, Wilson oversaw the referendum which confirmed the UK's membership of the European Economic Community. By then, a period of economic crisis was hitting the majority of Western countries, and in March 1976, Wilson suddenly announced his resignation as prime minister; he was replaced by James Callaghan. He remained in the House of Commons until retiring in 1983, when he was elevated to the House of Lords as Lord Wilson of Rievaulx.