Brian Barder, who has died aged 83, was one of the most energetic and politically committed diplomats of his generation. In retirement, he campaigned against injustices in the British legal system. From a range of postings from New York to Australia, the Soviet Union, Canada, Poland and Nigeria, his most gruelling but rewarding service came as Britain’s ambassador in Addis Ababa during the great Ethiopian famine of 1984-85. As the crisis developed, he waited with trepidation at an airfield in the capital with his wife, Jane. Media barons such as Robert Maxwell and rock stars including Bob Geldof were helping to fuel massive media and parliamentary pressure for Britain to help to feed the millions of starving people.

The UK government decided to send three RAF Hercules freight planes with aid. But after constant effort Barder had still not managed to get official clearance for them to land. Ethiopia’s socialist leadership was split, with hardliners arguing that no planes from a Nato air force should be allowed inside their country. Their main weapons supplier, the Soviet Union, took a similar line.

All that Barder could rely on was an unofficial last-minute telephone call from a senior member of the Ethiopian leadership, explaining that no agreement would be announced but the RAF planes would not be stopped from landing and could tacitly operate further flights.

It was a tenuous and easily deniable promise. As the Barders anxiously watched, the Hercules appeared in the African sky. There were no oil drums on the runway and no fighter planes ready to shoot them down. They landed safely and for the next 14 months regularly brought supplies for air drops to the famine-ridden highlands without ever getting official permission.

Beside the tension over the RAF’s role, Barder had to cater for “famine tourists” or “grandstanders on ego trips” who, he later recalled, usually expected meals at the residence. He and Jane were happier to give hospitality to genuine relief workers when they came out of the highlands for a rare break.

Born in Bristol into relatively well-off circumstances, Brian was the son of Vivien (nee Young) and Harry, a descendant of Polish Jewish immigrants and a successful furrier. His parents separated when Brian was four, and he was sent to a boarding preparatory school and then Sherborne school, Dorset.

At St Catharine’s College, Cambridge, where he gained a degree in classics, Barder was active in student politics and became chairman of the Labour Club. In 1956 he met Jane Cornwell when both were canvassing, and they married two years later. He remained a party member until his death, standing down for a few years towards the end of his diplomatic service only because he felt it was appropriate to be non-partisan while serving as an ambassador or high commissioner.

After taking the civil service exam he started in the Colonial Office in 1957, and in 1964 was sent to the UK desk at the UN on four-year secondment to what in 1967 became the Foreign and Commonwealth Office. It was the peak of decolonisation, and Barder met most of the leaders of the African independence movements, sparking his lifelong interest in the continent.

Back in London during the Biafra crisis in Nigeria, he made daily visits to Downing Street to brief Harold Wilson. During a stint in Moscow (1971-73) he was subjected to intimidation by KGB thugs who frequently jostled him and his wife in the lift going up to their flat in retaliation for the Heath government’s astonishing decision to expel 105 Soviet diplomats as alleged spies.

As ambassador in Poland (1986-88) when the Solidarity trade union movement was still banned, Barder frequently met its leader Lech Wałęsa in the Gdansk shipyards. Other Solidarity activists were invited to the Warsaw embassy. These encounters were designed to offer them protection.

Barder was knighted in 1992, during his final diplomatic posting, as high commissioner to Australia (1991-94).

In 1997 he was invited to join the newly created Special Immigration Appeals Commission as its lay member, sitting alongside two judges. The layperson was required to have security clearance and experience in assessing secret intelligence, as the SIAC’s job was to adjudicate cases of people whom the government wished to deport without giving defence lawyers the chance to know or challenge the reasons.

In 2004, when the home secretary, David Blunkett, gave the SIAC the additional job of examining the cases of people who were to be detained without trial because they were allegedly threats to Britain’s security, Barder resigned. His opinion, later endorsed by the law lords, was that sending people to prison without charge or trial breached the UK’s obligations under the European Convention on Human Rights.

Barder moved on to the issue of indeterminate sentences, a procedure also promoted by Blunkett whereby people could be sentenced on conviction to a “tariff” of a fixed number of years but then be held indefinitely in prison after serving the “tariff” if the authorities felt they would pose a threat to society on release. Barder considered it a Kafka-like system, since people had to refute subjective assessments about their future behaviour and there was almost no funding for them to make their case from behind bars or with adequate legal assistance.

Barder blogged and regularly had letters printed in the Guardian and other newspapers on issues including indeterminate sentences. Always convivial, he was a man of great generosity who was often contacted by partners or relatives of people given these unfair sentences, and he corresponded with many of them.

When the Conservatives took power in 2010 Barder started informal contacts with the Ministry of Justice under Ken Clarke, who also deplored the system and was battling against Theresa May as home secretary to have it abolished. Though it was finally stopped in 2012, some 2,200 prisoners who had been given these sentences before abolition and have served their tariff are still in custody today.

In 2014 Barder published What Diplomats Do, an imaginary account of the typical duties and challenges faced by a diplomat as he or she progresses up the career ladder, interspersed by reminiscences of key events in his own life. The book is probably the most useful introduction currently available for anyone thinking of diplomacy as a career.

He is survived by Jane and their children, Virginia, Louise and Owen.

• Brian Leon Barder, diplomat and civil rights campaigner, born 20 June 1934; died 19 September 2017