Barrister and legal adviser to the UK Government;

Born: January 14, 1926; Died: July 8, 2013.

Sir Ian Sinclair, who has died aged 87, was a legal adviser to the British Government for more than 30 years, helping negotiate Britain's 1972 Treaty of Accession into the European Economic Community (EEC). He also had a key restraining input into British policy during the 1982 Falklands war. It was he who persuaded Prime Minister Margaret Thatcher not to formally declare all-out war on Argentina in 1982, advising her to defend the Falkland islanders, legally with UN backing, but not to attack Argentina itself. He also suggested to her the idea of declaring a maritime exclusion zone around the Falklands, so that it would be clear to Argentinian forces that they were liable to be attacked if they entered that zone.

A devout Christian and well-travelled man who believed in diplomacy rather than belligerence, he was horrified when he learned that the Royal Navy task force had sunk the huge Argentinian troop ship, the General Belgrano, on May 2, 1982, killing 323 Argentinians, mostly young conscripts, even though the ship was outside the exclusion zone. He was on a transatlantic flight at the time, trying to liaise between Whitehall and Washington for a peaceful solution, and was not consulted by Mrs Thatcher. Although the sinking of the Belgrano was widely greeted with triumphalism in Britain - "Gotcha", splashed the Sun - it always distressed Sir Ian, who was more than aware that many of the Argentinian sailors were teenagers. (The Belgrano's captain did later admit, however, that he would have attacked the British task force given the chance).

During more than 30 years as a legal adviser to British prime ministers and foreign secretaries, Sir Ian was also a major player in negotiating the terms of Zimbabwean independence and the future of Hong Kong.

John McTaggart Sinclair (he later opted for Ian to distinguish himself from his father) was born in Glasgow on January 14, 1926, son of a successful businessman, John Sinclair, who had built up a timber-importing firm from scratch.

He was brought up in Renfrewshire and went to Glasgow Academy on the banks of the Kelvin and later Merchiston Castle School in Colinton, Edinburgh. A prodigy, he was still only 16 when he won a place to read law at Cambridge (King's College) where his most striking memories were eating tough whale meat during rationing, and patrolling the roof of King's College chapel to watch out for German incendiary bombs.

Just turned 18, he volunteered for the army's Intelligence Corps and in 1945 was on stand-by to be parachuted behind Japanese lines in Burma, to link up with 1st Battalion Royal Scots Fusiliers, when the war came to an end. He did, however, serve in Malaya as a sergeant for two years after the war, as part of the Commonwealth force trying to stabilise the country after the defeat of the Japanese. Based in Kuala Lumpur, he witnessed the rise of anti-British communist guerrillas which would lead to the Malayan Emergency, but he was able to return to Cambridge and gain a BA in 1948 and LLB the following year.

After his father died in 1950, he abandoned his doctorate studies and secured a job as an assistant legal adviser at the Foreign Office in Whitehall, sharing a flat with other young lawyers behind Selfridges department store on Oxford Street.

It was at a party with these friends that he met Barbara Lenton, a legal secretary at a firm of patent lawyers, and wooed her in his Austin 7 (nicknamed Jemima) with a rust-edged hole in the floor where they could watch the road go by. After he proposed at the Glyndebourne opera, they married on April 24, 1954, in Kensington.

In the late 1950s, he served as legal adviser to the British embassy in Bonn, and was recalled to London to help negotiate, unsuccessfully, Britain's entry into the original European Common Market. He later served as advisor to the UK Government at both the United Nations in New York and the British Embassy in Washington DC. Showing his true colours during the time US civil rights movement was at its most active, he personally insisted black visitors or staff at diplomatic parties in his apartment must be allowed to enter through the front door rather than the back stairs.

Back in London in the early 1970s, it was as legal adviser to what was by then called the Foreign and Commonwealth Office that he helped ensure Britain's entry into the EEC on the best possible terms. To do so, he had to get involved in such apparently trivial issues as the regulations for the use of so-called Kipper Brown, a mixture of synthetic dyes used to colour kippers, cooked hams and crisps. His work on that and slightly bigger issues saw him appointed CMG (Companion of the Order of St. Michael and St. George), not quite a knighthood and often given to British diplomats and "spooks". (A knighthood, KCMG, would follow in 1977).

Having taken silk in 1979, he became a successful barrister after his retirement from Whitehall, specialising in international law and sovereignty disputes and serving on the UN International Law Commission in Geneva for five years.

"He always remained a Scot at heart, loving his golf and his annual holiday in Orkney," his son Philip told The Herald. "The last years of his life have been hard for us all to bear as we have watched a man of towering intellect lose so much of his memory."

Knighted during the Downing Street tenure of Labour Prime Minister James Callaghan, Sir Ian, a passionate pro-European, found himself increasingly at odds with Mrs Thatcher over her stance towards Europe and took early retirement in 1984.

His wife of almost 60 years, Barbara, died in May this year. He died in a nursing home in Rake, Hampshire, after suffering from dementia and is survived by his sons Andrew and Philip, daughter Jane and a sister in Australia. His other sister, who lived in Scotland, predeceased him.