Prime Minister of the United Kingdom

The Prime Minister of the United Kingdom was an individual appointed by the monarch, based on which political party won a democratic vote. The Prime Minister was the political head of the United Kingdom.

In extreme situations where this wasn't an option, the monarch could 'invite' a political leader to form a government; this happened following the Slitheen's decimation of the government. As the UK lacked fixed terms and came under repeated assault and scandal from alien lifeforms, the 1960s-70s and early 21st century saw multiple Prime Ministers caused by rapid changes of government.

10 Downing Street was the seat of the Prime Minister's power (DW: Aliens of London) but after it was destroyed, the Prime Minister worked out of a temporary office in Westminster until 2008 when number 10 was rebuilt. (WEB: UNIT website, DW: The Sound of Drums) The Houses of Parliament were the meeting place of the Prime Minister and his cabinet. There they would discuss policy and law. (MA: The Plotters)

The Doctor and the Prime Ministers
The Doctor had numerous encounters with the Prime Minister of the United Kingdom. These associations seemed to vary between friendships and general assistance. (DW: Victory of the Daleks, et al.)

Using the alias Harold Saxon, the Master once became the Prime Minister. (DW: The Sound of Drums/Last of the Time Lords) However, the Doctor occasionally shunned the Prime Minister. He showed distaste towards Margaret Thatcher and opposed Harriet Jones's government. (DW: Father's Day, The Christmas Invasion)

Early 20th century
The Ninth Doctor mentioned meeting and drinking with David Lloyd George who was prime minister during World War I. (DW: Aliens of London)

In 1930, Charley Pollard named a Vortisaur "Ramsey", after Prime Minister, James Ramsay McDonald. (BFA: Storm Warning)

The Doctor spoke of having met and known then-Prime Minister Winston Churchill during World War II. In his sixth incarnation, he encountered Churchill twice before he became Prime Minister and prevented the Players from altering the man's timeline. (PDA: Players) At some point, they became good friends and he gave Churchill this telephone number. (DW: The Beast Below) They met more than once during the war, and each time Churchill would ask for use of the Doctor's TARDIS to end the war. (DW: Victory of the Daleks) Churchill would serve as Prime Minister again in the 1950s. (DW: The Idiot's Lantern)

1960s through 1980s
Harold Wilson was Prime Minister in the mid-1960s. He authorised the sacrifice of 12 children to the alien 456 in exchange for an antivirus. (TW: Children of Earth: Day Three) His support in the 1970 general election was eroded by a series of disasters at scientific research facilities in 1969-70, such as Wenley Moor. (MA: Who Killed Kennedy referencing DW: Doctor Who and the Silurians).

Edward Heath succeeded Wilson as Prime Minister, but his government quickly came under fire due to the chaos at a Britain-hosted peace conference. (MA: Who Killed Kennedy, referencing DW: The Mind of Evil)

Due to the multiple alien-caused crises and the Conservative and Labour Parties having conflicting policies on how to deal with them, the next general election saw a coalition of the Liberal Party and several fringe parties take power under Jeremy Thorpe (WEB: Party Politics). He was close to Global Chemicals, and forbade Brigadier Lethbridge-Stewart from investigating the company. (DW: The Green Death) Jeremy's government would fall due to repeated scandals, ending with the involvement of high-ranking ministers in Operation Golden Age. (WEB: Party Politics)

A few years later, the Brigadier conferred with a female Prime Minister (DW: Terror of the Zygons), Shirley Williams of the Labour Party. (WEB: Party Politics)

Margaret Thatcher became Prime Minister in 1979 (DW: Tooth and Claw) and would remain in power until at least 1987. (DW: Father's Day) During the late 1980s, the Doctor would also act as a consultant to Thatcher. (SP: Doctor Who: The Ultimate Adventure) Despite this, he would later show distaste towards her. (DW: Father's Day, Tooth and Claw)

1990s
On 6th May 1997, a recently elected unnamed male Prime Minister, was assassinated by his own bodyguard while in Washington during the Lord Xznaal crisis. (NA: The Dying Days)

Terry Brooks was Prime Minister in 1999. (PDA: Millennium Shock)

2000s
In the early 21st Century, Sherilyn Harper of the far-right New Britannia party came extremely close to being voted in as Prime Minister. (BFA: The Fearmonger)

An unnamed male Prime Minister incurred the wrath of ICIS and related interests in the government due to increased links with the European Union. After he signed the Euro-Combine Treaty, this conspiracy started a wave of terrorism in the hopes of getting him to declare martial law and give ICIS the power to take charge. He later declared he would shut down ICIS over this (BFA: The Longest Night), but they remained in existence for a while longer. (BFA: The Wasting)

Tony Blair was elected Prime Minister some time before Harriet Jones was appointed in 2006. (DW: Rise of the Cybermen)

In early 2006, following the 2005 general election, the United Kingdom had a male Prime Minister. He was killed by the Slitheen, and the position of Acting Prime Minister was then assumed by Joseph Green, actually Jocrassa Fel-Fotch Passameer-Day Slitheen wearing the slain Green's skin. Jocrassa and his brothers were later killed by a missile strike on 10 Downing Street. (DW: Aliens of London / World War Three) Following the Slitheen crisis, the real Prime Minister's death was officially deemed an accident. (WEB: whoisdoctorwho.co.uk)

This man may have been Tony Blair, given references in the episode to the then-current Labour government in the real world.

Harriet Jones was appointed Prime Minister by Queen Elizabeth II after the incident (WEB: UNIT website). By Christmas 2006, Jones had brought in a number of changes and was viewed positively, with some calling her term the start of a "golden age". Her destruction of the retreating Sycorax, however, earned her the disfavour of the Tenth Doctor and he ensured her political downfall. (DW: The Christmas Invasion) Torchwood Institute leader Jack Harkness once rang her, angrily demanding to know why Torchwood files were being "given" to the opposition leader (presumably "Saxon"). (TW: Greeks Bearing Gifts)

As "Harold Saxon's" website would refer to Jones as "one of my predecessors", she may have been forced out as Prime Minister before the May 2008 election. (WEB: www.haroldsaxon.co.uk)

Following that election, Saxon was elected as the head of a coalition formed by defectors from other political parties. (WEB: www.haroldsaxon.co.uk) Shortly after his election, he gassed his entire cabinet and introduced the Toclafane to the human race, before being shot and killed by Lucy Saxon, his wife. (DW: The Sound of Drums) The general public remembered him as having gone insane. (DW: The End of Time)

Following "Saxon", Aubrey Fairchild became Prime Minister (NSA: Beautiful Chaos). During the 2009 Dalek invasion of Earth the authorities, including Torchwood, lost contact with the Prime Minister's plane and he is implied to have died. (DW: The Stolen Earth)

Brian Green succeeded Fairchild. (TW: Children of Earth: Day One) He came under criticism from foreign governments after Martin Trueman intercepted global broadcasts. (SJA: Secrets of the Stars) He was Prime Minister during the 456 incident, first covering up Britain's history with the 456 (TW: Children of Earth: Day Two) and later deciding to hand over a tenth of the country's children. (TW: Children of Earth: Day Four) Afterwards, Denise Riley, with the backing of Bridget Spears, decided to blackmail him with the incriminating evidence. (TW: Children of Earth: Day Five) He remained Prime Minister following the crisis. (IDW: Don't Step on the Grass)

Far future
Hawthorne, in the 33rd century, was the equivalent of a Prime Minister on Starship UK. (DW: The Beast Below)

Alternate timelines
In a timeline in which Germany won World War II, Sir Oswald Mosley was Prime Minister, Churchill having been executed. (NA: Timewyrm: Exodus)

In Pete's World Britain had the office of President (head of state). It is unclear whether this position simply replaced the Monarch as head of state creating a semi-presidential system like in modern day France, or if it replaced the prime minister (head of government) creating a presidential system like the United States. (DW: Rise of the Cybermen / The Age of Steel)

List of Prime Ministers of the United Kingdom

 * David Lloyd George (DW: Aliens of London)
 * James Ramsay McDonald (BFA: Storm Warning)
 * Winston Churchill (DW: Victory of the Daleks)
 * Harold Wilson (MA: Who Killed Kennedy)
 * Edward Heath (MA: Who Killed Kennedy)
 * Jeremy Thorpe (DW: The Green Death)
 * Shirley Williams (DW: Terror of the Zygons)
 * Margaret Thatcher (SP: Doctor Who: The Ultimate Adventure)
 * Terry Brooks (PDA: Millennium Shock)
 * Tony Blair (DW: Rise of the Cybermen)
 * Harriet Jones (DW: The Christmas Invasion)
 * The Master/Harold Saxon (DW: The Sound of Drums)
 * Aubrey Fairchild (NSA: Beautiful Chaos)
 * Brian Green (TW: Children of Earth: Day One)
 * Hawthorne (equivalent of, DW: The Beast Below)

Behind the scenes

 * In real life, the Wilson government did have a sudden defeat in the 1970 election and Heath's government ran into difficulties very soon after it came in. Who Killed Kennedy by David Bishop attributed these problems to events in the Whoniverse involving the Third Doctor and UNIT.
 * The "Jeremy" reference in DW: The Green Death was a joke by the production team, implying Liberal Party leader Jeremy Thorpe would win the contemporary general election; the equivalent would be if a near-future episode of the new series implied the Green Party was going to win. (The production team assumed at the time that the UNIT stories actually took place in the near future.) In real life, he didn't win, though he was briefly in talks with Edward Heath to form a coalition government.
 * In the DVD commentary for Frontier in Space, Terrance Dicks says that the reference to the PM as female in DW: Terror of the Zygons was an ad-lib by Nicholas Courtney. The BBC Classic Who website has this mean Shirley Williams, who was only a Labour cabinet minister in real life.
 * Rather than finger a specific party, "Harold Saxon" is implied to have not been in a political party on the tie-in website and Green's party goes unmentioned. World War Three, however, made deliberate jabs at Tony Blair's Labour government and Harriet Jones says she was not one of "the babes", likely a reference to the term "Blair's Babes"; this would indicate the PM at the time (and Jones) was Labour.
 * The show indicates that "Saxon" was directly elected as Prime Minister. This is not how the position is attained.
 * According to Doctor Who: The Writer's Tale, originally in DW: The Stolen Earth or Journey's End, Prime Minister Fairchild was to have been exterminated by the Daleks at Westminster.