Alastair Rellie was on the front line of Britain’s Secret Intelligence Service (SIS), commonly known as MI6, for three decades and went on to become head of a number of departments, culminating in the post of Director of Counter-Intelligence and Security.

Born in Buckinghamshire in 1935, Alastair Rellie lost his father William, a naval officer, to wounds sustained in the Second World War, prompting his mother, Lucy, to move her four children to South Africa. He attended Michaelhouse, an Anglican boarding school, in Natal, before following his mother to the US and winning a scholarship to Harvard University to read History, graduating in 1960.

On returning to Britain he completed his National Service in the Rifle Brigade before spending a year in the City as a jobber, a role which did not stimulate him, so he applied for the Foreign Office. Successful, he was subsequently recruited by SIS, in 1963, after assuring them at interview, completely dishonestly, that low pay would not be a problem as he had private means.

Initial training was challenging and in a mock deep-cover operation under an alias, he gave himself away, somewhat embarrassingly, by wearing shoes from school in which his real name had been written by his mother in indelible ink. Rellie, nonetheless, had many other key qualities.

He entered the Service at a time when it had been rocked to the core following the defection to the USSR of Kim Philby, Britain’s most notorious Cold War double-agent. He later claimed he avoided detection for so long because he had been “born into the British governing class”. Rellie, however, was cut from a different cloth and his persistent optimism, patience, good humour and a sense of when to seize the opportunities that produced first-rate intelligence were to stand him in good stead and help put the Service back on an even keel.

His first postings helped him to learn and develop his craft. After a stint in Geneva, he returned briefly to the UK before being sent deep undercover to Egypt. Arriving at a time of hostility towards Britain following the 1956 Suez Crisis and the botched attempt to remove President Nasser from power, embassy staff were under constant surveillance so Rellie was tasked with operating under the radar.

While Britain tried to build diplomatic bridges, he was instructed to entertain the visiting Labour foreign secretary George Brown. Known for enjoying a tipple, Rellie ensured that the foreign secretary made the most of the hospitality offered. The following evening, Rellie indiscreetly mentioned this to a Times’ correspondent, resulting in it being splashed across the morning paper, without a source. The furious British ambassador ordered Rellie, as SIS station chief, to find the source of the leak. Rellie duly guaranteed to find the culprit and leave no stone unturned.

In 1970 he found himself in Kinshasa, in the Democratic Republic of the Congo, where he refined his ability to recruit and run agents, with Eastern Bloc “visitors” among his targets. Africa was awash with Communist agents as the East endeavoured to spread its ideology and influence, supported by large sums of money and arms. Rellie found himself collaboratingwith the local CIA station, which proved useful before his next move.

Based in New York, Rellie enjoyed a fruitful relationship with the FBI as he spent the next five years in a diplomatic role at the UK mission to the UN, where he played a constructive role on the Special Committee on Decolonisation, while defending Britain against Third World criticism for the problems of former colonies, mainly Rhodesia.

However, by night he was a different creature. Married in 1961 to a 19-year old drama student Annalisa (née Modin), a distant cousin, Rellie and his vivacious young wife lived a party lifestyle and enjoyed everything the Big Apple had to throw at them. Not one for pomposity and with a sense of the ridiculous, Annalisa was the perfect foil for Rellie during his career, prompting him to view people in a different way, which perhaps helped him become a more effective intelligence officer.

Upon returning to London, he was promoted to head-up SIS’s technical services, which covered the mundane, improving filing systems, to the ingenious, developing sophisticated bugging operations. Success here saw Rellie promoted to Controller Western Hemisphere, which meant he was responsible for the Americas, North and South.

Shortly afterwards, however, with little representation in Latin America, SIS and Britain were caught off guard by Argentina’s invasion of the Falkland Islands in 1982. Using all his years of experience, Rellie gained admirers for his adroit running of the Service’s war room during the conflict.

Making good use of his connections with the FBI and the CIA, SIS played an important role in the war’s outcome, not least by running operations to counter Argentine attempts to buy more Exocet missiles, from the French, with which to attack the British task force. He also wanted to stop arms getting to them through third party countries like Spain and Iran. Rellie managed to garner support from the Chilean junta, who offered secret help to British forces, including the use of remote airfields.

Rellie later made the most of Britain’s ability to relay information from such sources indirectly to the Americans. Supported by Prime Minister Margaret Thatcher, he later put intelligence structures in place to ensure there could be no future surprises in the area.

In 1985, following the extraction of the KGB double-agent Oleg Gordievsky from Moscow, Rellie held a welcome party at his home. Thereafter, the pair worked well together. Rellie was appointed CMG in 1987. Further promotions followed and as head of personnel he played a major part in the lifting of the service ban on gays. It had been introduced to prevent civil servants from being blackmailed but SIS had also worried about sending operatives to countries where homosexuality was illegal.

Rellie became a superb man-manager and gained a great reputation among colleagues for his relaxed approach, giving new recruits a certain degree of latitude to make mistakes and learn from them.

1990-92 was spent as Director of Counter-Intelligence where, in the climate of greater transparency and accountability, Rellie took a lead role. He oversaw the move to MI6’s swish glass lodgings next to Vauxhall Bridge and prepared, with Chief of SIS Sir Colin McColl, a programme of briefings for journalists, sometimes just to dispel myths about the Service, pointing out that staff were not licensed to kill and they all had to pay taxes.

Though earmarked for the top job, McColl decided to remain in situ to oversee the establishment of the service in law for the first time in 1994, and so Rellie decided to leave the Service “to the brave new generation” of the post Iron Curtain era. He enjoyed doing consultancy work for British Aerospace and later for Kroll, a US corporate investigators and risk consulting firm.

The Rellies took the opportunity to travel to countries that had been off-limits to them previously, including North Korea, China and numerous former Eastern Bloc countries.

He continued his annual poppy selling in Sloane Square and attended more Arsenal games. He finally gave up smoking aged 70, but continued with his Martinis and G&Ts. He once quipped, “If you don’t drink and you don’t smoke, you won’t live any longer. It’ll just seem that way.”

His wife died in 2014. He is survived by his three children, Euan, Jemima and Lucasta.