The eldest of four children of a Wembley teacher, Smith won a state scholarship to the Regent Street Polytechnic in London (taking the examination a year early) and then, a year before the Second World War, an Exhibition in Mathematics to Sidney Sussex College, Cambridge.
After only a year at Cambridge, however, Smith was drafted into the cadre of brilliant mathematicians and intellectuals at Bletchley Park which was tasked with breaking German cyphers. He became part of a close-knit team playing, in the words of one participant, "the frenetic equivalent of blindfold three-dimensional chess". Smith helped to supervise the "Bombes" in Hut 6 - machines built to mirror Germany's "Enigma" cypher device.
The five years at Bletchley had a profound influence on Smith's life. They widened his horizons and introduced him to some of the finest brains in Britain and, later, America. Away from code-breaking duty, he indulged his talent for amateur dramatics (he was a memorable Algernon in The Importance of Being Earnest) and formed life-long friendships. At 23 he married a university English teacher and Bletchley colleague, Mary Cropper, who was 15 years his senior. Smith's startled father put a garden fork through his own foot on learning of the engagement; but it was an outstandingly happy marriage.
Instead of returning to Cambridge after the War, Smith tried his hand at the new Foreign Office exam, designed to broaden its entry beyond the traditional ranks of diplomacy. His first attempt failed (he claimed that the examiner could not read his handwriting, but there was also a suspicion that his French was below par). Succeeding second time around, he was despatched to New York as the most junior UK delegate at the first meeting there of the UN General Assembly. Postings to Norway, Washington and Caracas followed, before he returned to London in 1956 as the Assistant Head of the African Department. One of his subordinates there, Charles Wallace, described in his memoirs, The Valedictory (1992), how Smith was always the first to arrive, having completed the Times crossword, and was seen as a good-natured perfectionist: "any draft he approved without alteration was regarded as a measure of excellence by the originator".
After this varied early career, Howard Smith was sent to the key post of Head of Chancery in Moscow in 1961, at the height of the Cold War. Early in his tour, he travelled to Alma Ata in Kazakhstan only to be given a message by the Mayor, without explanation, to return to Moscow. The Cuban Missile crisis had broken out, and the world was on the brink of nuclear war. In an acutely testing period, he provided vital support to two eminent Ambassadors, Sir Frank Roberts and Sir Humphrey (later Lord) Trevelyan. Returning to London in 1963, he was the Head of the Department dealing with the Soviet Union and Eastern Europe for the next five years, through the Prague Spring and the subsequent Soviet invasion of Czechoslovakia. The somewhat dubious reward for Smith's expert and perceptive advice was to be posted as Ambassador at Prague in 1968, in the aftermath of the invasion. He did what he could there to keep hope alive, particularly through support for the arts and the work of the British Council, involving himself in visits by leading British cultural figures.
Smith's tour in Prague was cut slightly short in 1971, when he was asked to go to Northern Ireland, where the situation was steadily worsening. In the last months of the Stormont Assembly, he had the difficult task of acting as Whitehall's man on the spot while sending advice back to the Home Secretary. Not without personal risk, he developed a vast circle of contacts of all shades of opi- nion and preserved in his own house there a place of friendly discussion and reason through the transition to direct rule.
After a spell at the heart of Government, in the Cabinet Office, Smith returned to Moscow as Ambassador in 1976. As before, the complexities of Soviet life brought out the best in him. His mathematician's analysis of the Soviet enigma brought originality and vision to his reporting, for example on difficult arms control issues. He was firm and patient in equal measure with Soviet officials. The concern which he and his wife showed for their staff and the British community at all levels inspired loyalty and affection.
Smith had believed that retirement would follow his Moscow posting, but in an unexpected turn his political masters - this time a Labour Government - once again asked him to cut short an Ambassadorial tour to take on a tricky assignment at home. Rather than promote from within, James Callaghan had decided to appoint an external head of the Security Service. Though the retreat behind closed doors was a mixed blessing for him, Smith took up the challenge before retiring in 1981 to a house in Sussex he had designed himself.
His three years at the Security Service were clouded by a grave illness for his wife. After her death in 1982, he found great happiness again in his marriage to Mary Penney, one of the couple's Bletchley friends and later a violinist in the BBC Symphony Orchestra. She died four months before him.
Howard Frank Trayton Smith, diplomat: born London 15 October 1919; Counsellor, Moscow 1961-63; Counsellor, Foreign Office 1964-68; CMG 1966, KCMG 1976, GCMG 1981; Ambassador to Czechoslovakia 1968-71; UK Representative in Northern Ireland 1971-72; Deputy Secretary, Cabinet Office 1972-75; Ambassador in Mos-cow 1976-78; Director-General of the Security Service (MI5) 1978- 81; married 1943 Mary Cropper (died 1982, one daughter), 1983 Mary Penney (died 1996); died 7 May 1996.