The home secretary, Sajid Javid, decided to cooperate with US authorities in the prosecution of two alleged Islamic State fighters, without assurances they would not face the death penalty, in order to avoid “political outrage” in the Trump administration, the high court has been told.

The allegation came as the lord chief justice, Lord Burnett of Maldon, and Mr Justice Garnham heard an application on behalf of the mother of El Shafee Elsheikh over the legality of the Home Office’s agreement to provide evidence to US prosecutors.

Elsheikh and Alexanda Kotey, who were raised in Britain, are alleged to have been part of an Isis terrorism cell, some of whom were known as “the Beatles”, that is thought to have carried out 27 beheadings of US and UK citizens in Isis-held territory. Those killed included the British aid workers Alan Henning and David Haines and the American journalists James Foley and Steven Sotloff.

The pair, who have been stripped of their British citizenship, were captured in February by Syrian Kurdish fighters, prompting behind-the-scenes negotiations between the UK and the US governments over where they should be prosecuted.

The decision not to seek assurances from the US that the two men would not face the death penalty was in defiance of advice from the Foreign Office and senior civil servants, said Edward Fitzgerald QC, who represents Maha El Gizouli, Elsheikh’s mother.

It also broke with the policy of two previous home secretaries, Theresa May and Amber Rudd, who had sought such assurances in the cases of both suspects, the court was told. In April, however, the security minister, Ben Wallace, first broke ranks and indicated he opposed seeking assurances.

Javid’s determination in May to abandon seeking such assurances over the death penalty was “in large part because of anticipated outrage among political appointments in the Trump administration”, Fitzgerald said. Boris Johnson, the then foreign secretary, eventually agreed with him.

Elsheikh was captured in January. Metropolitan police documents written shortly afterwards suggest he and Kotey were being held by US forces in Iraq, the court was told.

The US attorney general, Jeff Sessions, had initially pressed for Elsheikh and Kotey to be prosecuted in the UK, acknowledging that 600 statements taken by the Metropolitan police’s counter-terrorism command would be needed to convict them.

The Crown Prosecution Service had advised that any prosecution in the UK would collapse because of “issues of mistreatment during detention and and the legal basis of return to the UK”.

At a later US Senate panel hearing, Sessions expressed “disappointment that the British are not willing to try the case but had tried to tell [US prosecutors] how to try them”, Fitzgerald said. Gizouli was not bringing that case “to excuse the appalling acts of which her son is accused”, he added.

She accepts he should be appropriately punished. “Her concern is the death penalty … It’s relevant that the families of the victims have said they want justice but not the death penalty.”

If imposed, Elsheikh and Kotey would suffer a “gruesome and painful” death through lethal injection. Executions in the US are often long-delayed and delivered through a system “that is unreliable, tortuous and experimental”, Fitzgerald said.

Defending the decision, Sir James Eadie QC, for the home secretary, said in written submissions that it was accepted that Elsheikh was outside the protections of the Human Rights Act.

Those arguing for assurances over the death penalty faced “insuperable barriers” in showing that there was a common law right that the home secretary had to “protect an individual’s life from the actions of a third party”, Eadie said.

Nor was there any common law prohibition on the provision of legal assistance where it might be used to impose the death penalty in a foreign state, he added.

This is the first time there had been a “deliberate attempt” to depart from the long-established UK policy of opposing the death penalty around the world, Fitzgerald said.

The only previous incident, in 2014, involved British police cooperating with officers in Thailand, but when it was opposed, he said, the courts stopped it on the grounds that the police had “acted unlawfully and failed to have regard for public policy”.

Not only had Javid not sought assurances over the death penalty, the court was told, he even decided not to take up earlier partial assurances the Americans had offered over not using British evidence directly for seeking the death penalty.

The British ambassador to Washington, Sir Kim Darroch, had warned Javid that seeking death penalty assurances would provoke “something close to outrage” among Sessions, James Mattis, the US defence secretary. and Mike Pompeo, the US secretary of state.

“These political appointees would be outraged and they will wind up the president and he will hold a grudge,” Fitzgerald said, and that would damage relations between the UK and US.

Javid met Sessions in late May. According to records of a senior civil servant released to the court, Javid assessed that “if he asked for assurances it was likely to prompt outrage”. Accordingly, he had decided not to ask for any assurances. This was an “an unworthy capitulation”, Fitzgerald commented.

Correspondence released to the court show that in June Javid wrote to Johnson stating that “significant attempts having been made to seek a full assurance, it is now right to accede to the mutual legal assistance (MLA) request without an assurance [over the death penalty]”.

Johnson’s reply pointed out that not obtaining assurances carried a political and security risk to the UK “should the men be executed”. Nonetheless, he concluded, this was a “unique and unprecedented case, [so] it is in the UK’s national security interests to accede to an MLA request for a criminal prosecution without death penalty assurances for Kotey and Elsheikh”.