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 agent, James Bond.
Sir Miles Meservy 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 Meservy was appointed to head HMSS' Foreign Intelligence wing and became responsible for a corps of dedicated agents under the Double O prefix, a prefix giving these agents a license to kill. Meservy clashed frequently with the agent who became HMSS' most decorated, Commander James Bond. Meservy's 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 Meservy's 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. Meservy 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.
Meservy's 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 Meservy 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 nerve gas base set up by SPECTRE, and gathering evidence of planted agents throughout the world bearing nerve gas capsules. Meservy attended the subsequent wedding of Bond and Tracy - a day that Blofeld made sure Bond would never forget, or forgive.
Meservy 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. His replacement, Admiral Robert Hargraves, had commanded the nuclear submarine squadron of the Royal Navy and was familiar with Commander Bond from his periodic duties with the Fleet. Hargraves was tougher with Bond than Meservy, arresting him in Florida during the License To Kill Affair but seeing him escape to wage a successful war against criminal kingpin Franz Sanchez.
In the early 1990s Hargraves retired and his replacement, 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 Mawdsley 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. Mawdsley'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, Mawdsley 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.
Mawdsley 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, Colonel Mallory became the new head of MI6.
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 serves in is a member of parliament [MP] or a government employee within MI6.) After his retirement from the British Army, Mallory moved to MI6, and upon the death of M (Judi Dench), he replaced her in the position. After the Skyfall Affair, Bond reports to Mallory for the first time and calls him "M."
During a meeting between Mallory and Mawdsley early in the Skyfall Affair, he calls her Eleanor, perhaps her first name -- rather than "Barbara."