“What holds us together is an idea, and it’s a story about who we are and what’s important to us.” So said President Barack Obama in one of his final interviews in office.

Jack Straw and UK government must face kidnap and torture claims, court rules Read more

Here in the UK, there used to be agreement on this story: fair play. The rule of law. Open justice. The abhorrence of torture. It is all there, in Magna Carta. Britons like to say we taught the world these values.

Yet on Tuesday, it was not the government, but the supreme court that struck a blow for these values – against ministers who have fought for half a decade to have them overruled.

The judgment concluded years of bitter legal fighting over one of the nastiest episodes of the “war on terror”: the “rendition” (kidnapping) and delivery to Muammar Gaddafi’s Libya of two dissidents, their wives, and their children, in a joint MI6-CIA operation.

What British officials were party to when the UK government determined in 2004 that Gaddafi ought to be converted from an enemy to a friend would turn anyone’s stomach. One of our top security officials, Sir Mark Allen, stepped in to arrange the love-in. And MI6, working with their partners in Libya and the CIA, conspired to kidnap two Libyan families: senior dissident Abdel Hakim Belhaj and his wife Fatima Bouchar, who was five months pregnant at the time; and Sami al-Saadi and his wife, and their four children, aged between six and 12.

This was the dark side of the famous “deal in the desert”. The government of the time briefed this as a historic victory – before everyone discovered the deal was bought at the price of the suffering of Bouchar and her unborn son, and four young and terrified children.

This price was too much to swallow even for the head of MI5. Baroness Eliza Manningham-Buller, once told about Britain’s role in the abductions after the fact, was livid. She reportedly wrote an unprecedented letter to Tony Blair in protest – accusing MI6 of risking the lives of intelligence officers. She threw MI6 staff out of Thames House in protest, a startling show of rancour between sister intelligence agencies. Manningham-Buller’s fury was straightforward. She understood what massive damage these excesses do to national security, outweighing any temporary benefit gleaned from a despot such as Gaddafi.

Saadi and his family settled their claim in 2012 when the British government paid them £2.2m.

This case has never been about money for Belhaj and his wife. Years ago they offered to drop the case, forgive, and forget, for just £1 from each defendant – and an unreserved apology. Yet the government has refused – opting instead to run up a bill of hundreds of thousands of taxpayers’ pounds in an attempt to have the case thrown out of court – an attempt unanimously rejected by the supreme court this week as out of keeping with centuries-old British rights.

Neither is this case only about our history. On Friday Donald Trump will take control of a vast security apparatus – one with unprecedented powers to surveil, kidnap, disappear and, yes, kill people by remote control. Trump has pledged enthusiastically to bring back the torture programme of the George W Bush era – including waterboarding and “a hell of a lot worse”.

It is all very well to say the CIA promises not to torture and that MI6 doesn’t want to – that the internal culture of the intelligence agencies has changed. What happens on the night is often a different story. In 2004, the security services of Britain were all too ready to barter the lives of Bouchar and her unborn son for a supposed advantage in negotiations with Gaddafi. Who is to say that we will respond to the next crisis with our morals intact?

Special report: Rendition ordeal that raises new questions about secret trials Read more

One thing stands between us and the brink. It is old-fashioned – even unfashionable – because it is imperfect. It is the rule of law. This doesn’t just protect people such as Bouchar; it protects the reputations and lives of intelligence officers too.

It isn’t normal for a judgment to reach back to laws and customs from more than eight centuries ago, as this week’s did. When the court cites Magna Carta at your government, soul-searching is in order.

These excesses did not take place on the current prime minister’s watch. But it is her responsibility, as leader of the government, to put things right. She can do this by simply apologising to the victims – and assuring the public that we will never again be caught up in the horrors of rendition and torture. This – not spending hundreds of thousands on an army of lawyers – would demonstrate that she is serious about standing up for the values that make us who we are.