Margaret Thatcher's term as the prime minister of the United Kingdom began on 4 May 1979 when she accepted an invitation of Queen Elizabeth II to form a government, and ended on 28 November 1990 upon her resignation. She was elected to the position in 1979, having led the Conservative Party since 1975, and won landslide re-elections in 1983 and 1987. She gained intense media attention as Britain's first female prime minister, and was the longest-serving British prime minister of the 20th century. Her premiership ended when she withdrew from the 1990 Conservative leadership election.