The head of the Foreign Intelligence wing of Her Majesty's Secret Service (HMSS) is a rotating duty that has been undertaken by numerous individuals in the decades since the Second World War; those responsible for the job go by the code name of M. Three of the most famous leaders of HMSS have become synonymous with the derring-do of HMSS' most famous and valuable agent, Commander James Bond
Admiral Sir Miles Messervy, KCMG, RN (retired)
Sir Miles Messervy (Bernard Lee) was an old school warrior in the Royal Navy who'd served with distinction on battleships before and during the global conflagration. Upon the war's end Admiral Messervy, Companion in the Most Distinguished Order of St. Michael and St. George, became Knight Commander
in that order, thereafter addressed as Sir Miles. He also was appointed to head HMSS' Foreign Intelligence wing, after a half-crazed officer murdered his predecessor in his very office. (Commander Bond would later say of him, "He more-or-less inherited his 'K' with the job," by way of explaining his, Bond's, refusal to accept elevation to knighthood. He was correct. All the M's, reflecting their capacities as senior non-military officers running a service that operates in foreign countries, have the rank of K/DCMG.)
Sir Miles invented and recruited a corps of dedicated agents under the Double O prefix, a prefix giving these agents a licence to kill. Sir Miles clashed frequently with the agent who became HMSS' most decorated, Commander James Bond. Sir Miles' lack of patience with Bond's often-improvised method of investigation and action never led him to doubt the veracity of information his agent provided - notably on the Thunderball Affair when an RAF officer objected when Bond reported seeing the body of a pilot thought to have boarded a Vulcan nuclear bomber - and Sir Miles' patience, though always tested, nonetheless proved sound in numerous encounters by Commander Bond over the decades with terrorist groups, Cold War enemies, and the underground criminal group SPECTRE (SPecial Executive for Counterintelligence, Terrorism, Revenge and Extortion). Sir Miles never hesitated to enter the field himself, in such incidents as the You Only Live Twice, Man With The Golden Gun, Spy Who Loved Me, and Moonraker Affairs; in the Spy Who Loved Me Affair he met face to face with his then-opposite in the Soviet KGB, General Anatole Gogol.
In the Moonraker Affair, Bond and M are bridge partners against Sir Hugo Drax and his cohort, long before Drax's evil plot is revealed.
Sir Miles' off-duty hobbies included a passion for lepidoptery, and he was caught off guard during the Her Majesty's Secret Service Affair when Bond showed a fluent understanding of butterflies and moths.
Only once did Sir Miles pull rank enough on Commander Bond to veto proposed action against an enemy, in the Her Majesty's Secret Service Affair when the Commander's fiance, Tracy Draco (Contessa Teresa di Vicenzo), was captured by SPECTRE agents; Bond disobeyed orders and secretly arranged with Tracy's father, a Sicilian mafia don who had worked with SPECTRE's leader Ernst Stavro Blofeld in the past, for a raid on SPECTRE's hidden hideout in the Swiss Alps, rescuing his bride, destroying a bio-weapons base set up by SPECTRE, and gathering evidence of planted agents throughout the world bearing a deadly and highly catholic viral agent designed to destroy crops and livestock alike. Sir Miles attended the subsequent wedding of Bond and Tracy - a day that Blofeld made sure Bond would never forget, or forgive.
Sir Miles fell ill some weeks after the Moonraker Affair; in early 1981 he was placed on leave, but he succumbed to stomach cancer following the For Your Eyes Only Affair.
Admiral Sir Robert Hargraves, KCMG, RN
Sir Miles' replacement, Admiral Sir Robert Hargraves (Robert Brown), had commanded the nuclear submarine squadron of the Royal Navy and was familiar with Commander Bond from his periodic duties with the Fleet. Sir Robert was tougher with Bond than Sir Miles had been. For instance, he arrested Bond in Florida during the License To Kill Affair, only to see Bond escape to wage a successful war against criminal kingpin Franz Sanchez.
In the early 1990s Sir Robert retired.
Dame Barbara Mawdsley DCMG
Sir Robert's replacement, Dame Barbara Mawdsley, the first woman to ever head HMSS, faced steady resistance within the Foreign Intelligence bureaucracy because of her status as an "Evil Queen Of Numbers," as Bond's friend William Tanner derisively nicknamed her. She nonetheless overcame this bureaucratic resistance and trusted Bond enough that he succeeded against new threats in the 1990s and early in the 21st century, notably against former Double-O agent Alec Trevelyan, who was killed in the Goldeneye Affair, the sinking of HMS Devonshire
(which brought Britain and China to the brink of war thanks to the machinations of Elliot Carver), a terrorist plot to destroy Istanbul (during which Dame Barbara herself was briefly captured) and a plot by North Korean officers who had secretly placed a laser cannon in orbit (using the guise of flashy British billionaire Gustav Graves) to destroy Allied power in South Korea. Dame Barbara's trust in Bond was tested in this Die Another Day Affair when she was forced to relieve him of duties after he was released from capture by North Korea because of suspicion he had leaked, under torture, information to enemy officers; she nonetheless trusted Bond enough to reinstate him when he provided evidence linking North Korea to Gustav Graves and stood up to the anger of American intelligence officer Damien Falco.
In The World Is Not Enough Affair, Dame Barbara revealed to Bond that she had a relationship with Robert King when they read law together at Oxford. Thus she was sympathetic to King's request to pay ransom for his daughter Electra King, and sent Bond to deliver the ransom, kicking off the events that revealed Electra's plan to destroy Istanbul, so that her own oil pipeline would have a monopoly to the Black Sea.
Dame Barbara also had a memorable confrontation during the Tomorrow Never Dies Affair with the Royal Navy's commander, Admiral Roebuck, though the two also had a respect for one another through friendship with a family, the Hardcastles, they both knew.
The present M continued in her capacity as head of one of the world's strongest intelligence and counterterrorist forces through the Quantum of Solace Affair, where she thought Bond had quit HMSS but then heard him say, "I never left."
She was deeply involved in Bond's most recent adventure, where another former Double-0 agent, Raoul Silva, attacked MI6 headquarters, killing 8, and later attacked M, taking revenge for her failure (when M was head of HMSS's Hong Kong Station and Silva was an agent there) to rescue Silva when he was captured by the Chinese and held in isolation for five months. She did, however, arrange for Silva's release from China in exchange for 6 Chinese prisoners held by the British. In Silva's attack on Skyfall (the Bond family's long-abandoned estate in Scotland), she was shot in the abdomen but lived long enough to see Bond kill Silva with a thrown knife.
After her death in Skyfall, Her Majesty elevated her posthumously to the rank of Dame Grand Cross of Sts. Michael and George (GCMG). The Queen did this to fulfill a promise offered Dame Barbara when she faced involuntary retirement over the theft of the list of agents.
Colonel Gareth Mallory became the new head of MI6.
Sir Gareth Mallory, KCMG
Sir Gareth Mallory (Ralph Fiennes) served as a lieutenant colonel in the British Army and was captured and imprisoned by the IRA for six months earlier in life. During the events of the Skyfall Affair, he was chairman of the Security and Intelligence Committee. (The film does not make clear whether Mallory is a member of parliament [MP] or a government employee within MI6.) After his retirement from the British Army, Mallory moved to MI6. Upon the death of M (Judi Dench), he replaced her in the position and earned the knighthood that goes with it. After the Skyfall Affair, Bond reports to Mallory (now known as Sir Gareth outside HMSS) for the first time and calls him "M."
During a meeting between Mallory (as he was then known) and early in the Skyfall Affair, he calls her Eleanor, perhaps her first name -- rather than "Barbara."