The government’s attempt to strip two alleged Islamists of their British citizenship was unlawful, judges have ruled in a case that could hamper attempts to stop Isis fighters returning to the UK.

The men, who are not accused of any association with Isis, were among more than 100 people to be stripped of British nationality last year as the government increased its use of the controversial power.

Their successful appeal sets a new legal precedent and could spark a more cautious approach to citizenship deprivations by the government.

It may also trigger a wave of appeals by terror suspects facing what one lawyer called “a return to the medieval penalties of banishment and exile”.

The Special Immigration and Appeals Commission allowed an appeal by two men – codenamed E3 and N3 – after closed hearings where their lawyers and government representatives battled over their status.

Allegations made by the security services were not detailed in the published judgment or shared with the men’s lawyers, who had to leave the courtroom for “closed evidence”.

The government argued they were dual British-Bangladeshi nationals, but Mr Justice Jay ruled that the deprivation orders had rendered them stateless and therefore violated international law.

E3, a 37-year-old man, was born in the UK to two Bangladeshi parents and received the order in June 2017.

Isis 'Beatles' militants captured in Syria: 'It is too late for a fair trial'

He had been working in Britain to support his family in Bangladesh, and had his citizenship removed while visiting the country for the birth of his second child, his lawyers said.

In October 2017, N3 – who has three British children living in the UK – was deprived of his citizenship after travelling to Turkey for business for a few weeks, his lawyers said.

The 35-year-old was born in Bangladesh but is a British citizen by birth, and remains in Turkey.

Duncan Lewis Solicitors said both men were targeted on national security grounds days before they were due to return to the UK, and have been left “stranded in foreign countries without any source of income or support”.

The commission found that Bangladeshi law required them to apply to retain their citizenship at 21, but they failed to do so and were left with only British nationality.

Fahad Ansari, a solicitor who represented the appellants, voiced “deep concern that there appears to be an ongoing practice of the home secretary to deliberately wait until individuals leave the UK before depriving them of their citizenship”.

He argued that any suspected criminal activity should have been prosecuted in the UK, adding: “The practice of depriving individuals of their citizenship while they are abroad, without any form of due process, is nothing less than a return to the medieval penalties of banishment and exile.”

The Home Office intends to appeal the judgment and the men have put on plans to return to the UK until the case concludes.

The judgment was handed down in private on 15 November, almost a year after the government was found to have unlawfully stripped another person of Bangladeshi descent of British citizenship.

The London-born woman, known as G3, was alleged to be an Isis member and was detained by Turkish authorities on the Syrian border with her two young children in 2016.

UK news in pictures Show all 50 1 /50 UK news in pictures UK news in pictures 18 September 2020 A model presents a creation during the Bora Aksu catwalk show at London Fashion Week 2020 Reuters UK news in pictures 17 September 2020 World kickboxing champion Carl Thomas during his attempt to run a marathon while pulling a plane at Elvington Airfield near York. The attempt is raising funds for Ollie's Army Battling Against Battens, an organisation campaigning to raise GBP 250,000 to fund a clinical trial aimed at saving the sight of children with CNL2 Batten Disease PA UK news in pictures 16 September 2020 Labour deputy leader Angela Rayner speaking during Prime Minister's Questions UK Parliament/AFP/Getty UK news in pictures 15 September 2020 People enjoying the autumn sunshine as they punt along the River Cam in Cambridge PA UK news in pictures 14 September 2020 Early morning light bathes the skyscrapers of the City of London, at the start of a week in which the UK is expected to bask in temperatures of more than 30 degrees PA UK news in pictures 13 September 2020 England celebrate after they dismissed Australia's Alex Carey to win the second ODI match of the series at Emirates Old Trafford, Manchester PA UK news in pictures 12 September 2020 Protesters outside BBC Broadcasting House in central London, as marches and rallies form across the country calling for a 15% pay rise for NHS workers and an increase in NHS funding PA UK news in pictures 11 September 2020 An empty migrant dinghy floats off the beach at St Margaret's Bay after the occupants landed from France in Dover Getty UK news in pictures 10 September 2020 A view of small boats thought to be used in migrant crossings across the Channel at a storage facility in Dover, Kent PA UK news in pictures 9 September 2020 EU's chief negotiator Michel Barnier, left, arriving from the Eurostar with EU Ambassador to the UK, Portuguese diplomat Joao Vale de Almeida at St Pancras International railway station, London, for the latest round of the negotiations on a free trade deal between the EU and the UK PA UK news in pictures 8 September 2020 Dawn over Coquet Island, a small island off Amble on the Northumberland coast PA UK news in pictures 7 September 2020 A hovercraft arrives to Southsea, Hampshire from the Isle of Wight PA UK news in pictures 6 September 2020 Forensics officers near the scene of multiple reported stabbings in Birmingham Reuters UK news in pictures 5 September 2020 Anti-migrant protesters demonstrate in Dover against immigration and the journeys made by refugees crossing the Channel to Kent PA UK news in pictures 4 September 2020 Activists take part in a demonstration against the HS2 hi-speed rail line outside the Department of Transport AFP via Getty UK news in pictures 3 September 2020 Peter Baker, who plays Trigger in the musical version of Only Fools and Horses, sweeps the stage of the Theatre Royal Haymarket in London, after observing a 15 minute silence to show solidarity with those in the theatre industry that have lost their jobs due to the coronavirus pandemic PA UK news in pictures 2 September 2020 Kadie Lane, right, 11, and Brooke Howourth, 11, hug on their walk to Marden Bridge Middle School in Whitley Bay, Tyne and Wear, for their first day of term, as schools in England reopen to pupils following the coronavirus lockdown PA UK news in pictures 1 September 2020 Extinction Rebellion protesters sitting outside The Houses of Parliament in Westminster, London PA UK news in pictures 31 August Surfers at Long Sands Beach, Tynemouth PA UK news in pictures 30 August Black Lives Matter protesters march through Notting Hill in London in the first Million People March EPA UK news in pictures 29 August A protester reacts as she demonstrates against the lockdown and use of face masks, amid the coronavirus disease outbreak, outside Downing Street in London Reuters UK news in pictures 28 August Caribbean soca dancers display their costumes as they promote the first ever digital Notting Hill Carnival, following the cancellation of the normal Carnival festivities due to the continued spread of the coronavirus disease, in London Reuters UK news in pictures 27 August Father and son team Chris and Sam Milford from historic building conservation specialists WallWalkers begin restoration work on the spire of Norwich Cathedral, which stands at over 312ft high. The first known spire was completed in 1297 PA UK news in pictures 26 August Giant waves at Seaham in County Durham, as the bad weather continues PA UK news in pictures 25 August An assistant at the Wallace Monument cleans the case which houses the William Wallace sword in the Hall of Arms room at the monument near Stirling as they prepare to re-open PA UK news in pictures 24 August Restored World War Two landing craft LCT 7074 is transported from from the Naval Base in Portsmouth to its final resting place at the D-Day Story at Southsea PA UK news in pictures 23 August Jenny Nguyen and Tony Cao, from Vietnam, pose for wedding photos on Tower Bridge in London, as it remains closed to vehicles after it was stuck open on Saturday due to a "mechanical fault". The landmark's Twitter account confirmed only pedestrians and cyclists could use it on Sunday morning PA UK news in pictures 22 August England's Zak Crawley hit 267, joining the exclusive Double Hundred club, on day two of the Third Test match against Pakistan at the Ageas Bowl, Southampton PA UK news in pictures 21 August Harri Teale gathers lavender during the annual harvest on the Wolds Way Lavender farm near Malton in North Yorkshire PA UK news in pictures 20 August Parents and a student react after checking GCSE results at Ark Academy in London Reuters UK news in pictures 19 August Tate Modern workers hold a strike outside the gallery in London, to protest the institution's announcement that it would cut more than 300 jobs from its commercial arm, Tate Enterprises PA UK news in pictures 18 August Two rescued brown bear cubs, Mish (left) and Lucy, cool off in a pool after arriving at their new home with the wildlife conservation charity Wildwood Trust in Herne Bay, Kent. The orphaned pair, who have been living in a temporary home in Belgium since they were found abandoned and alone in a snowdrift in the Albanian mountains, will be acclimatised to their new life in the country before moving to a permanent home PA UK news in pictures 17 August A level students celebrate outside the Department for Education in London after it was confirmed that candidates in England will be given grades estimated by their teachers, rather than by an algorithm. The government U-turn comes just days after Education Secretary Gavin Williamson vowed there would be "no U-turn, no change. PA UK news in pictures 16 August Wasp players take a knee as Northampton Saints stand prior to kick-off in their Premiership match at Franklin's Gardens PA UK news in pictures 15 August Piper Colour Sergeant Lil Bahadur Gurung attends the VJ Day National Remembrance event, held at the National Memorial Arboretum in Staffordshire, Britain Reuters UK news in pictures 14 August People including students hold placards on Whitehall outside Downing Street as they protest against the downgrading of A-level results. The government faced criticism after education officials downgraded more than a third of pupils' final grades in a system devised after the coronavirus pandemic led to cancelled exams yes AFP via Getty UK news in pictures 13 August Benita Stipp (centre) and Mimi Ferguson (left) react as students at Norwich School receive their A-Level results PA UK news in pictures 12 August 2020 A train derailment near Stonehaven has left three people dead. Driver Brett McCullough, conductor Donald Dinnie, and a passenger were killed when the 6.38am Aberdeen to Glasgow Queen Street service crashed amid heavy rain and flooding BBC UK news in pictures 11 August 2020 A woman hydrates in the sun after open water swimming at the West Reservoir Centre in north London Tolga Akmen/AFP via Getty UK news in pictures 10 August 2020 Prime Minister Boris Johnson takes part in an archery session as he visits Premier Education Summer Camp at Sacred Heart of Mary Girls' in Upminster Reuters UK news in pictures 9 August 2020 People cycle through Cambridge as the heatwave continues in Britain EPA UK news in pictures 8 August 2020 Healthcare workers take part in a protest in London over pay conditions in the NHS Getty UK news in pictures 7 August 2020 Emergency services make their way along the seafront on Bournemouth beach in Dorset on one of the hottest days of the year PA UK news in pictures 6 August 2020 Alison Murphy poses for a picture by husband Peter as she walks through a field of sunflowers in Altrincham, Cheshire PA UK news in pictures 5 August 2020 Pakistan's Abid Ali being bowled by England's Jofra Archer during day one of the First Test match at the Emirates Old Trafford, Manchester PA UK news in pictures 4 August 2020 The 'Timbuktu tumblers' from Kenya perform their balancing act on the Southsea waterfront as Zippos Circus reopens in Portsmouth Rex UK news in pictures 3 August 2020 Pelicans interact with a visitor in St James's Park in London PA UK news in pictures 2 August 2020 Lewis Hamilton drives with a puncture towards the finish line to win the Formula One British Grand Prix at Silverstone POOL/AFP via Getty UK news in pictures 1 August 2020 Arsenal's Pierre-Emerick Aubameyang celebrates with the trophy and teammates after winning the FA Cup, as play resumes behind closed doors following the outbreak of the coronavirus disease Pool via Reuters UK news in pictures 31 July 2020 People enjoy the sunny weather at a Bournemouth Beach Reuters

Her deprivation order was similarly found to have rendered her stateless under international law by Mr Justice Lane.

E3, N3 and G3 were among more than 100 people deprived of UK nationality last year, as the government dramatically increased its use of the exceptional power.

In 2017, it was used to strip 104 people of their British citizenship, compared to just 14 people in 2016.

The measure has been used for high-profile terrorists, including alleged members of the British Isis cell known as the Beatles.

Alexanda Kotey and El Shafee Elsheikh, who remain imprisoned by Kurdish forces in Syria, accused the government of breaking international law and suggested they were both stateless in an interview from custody.

It is unclear whether Elsheikh, who came to the UK as a child refugee from Sudan, or London-born Kotey – who is half-Ghanaian and half-Greek Cypriot – actively held dual nationalities or will have to apply for alternative citizenship.

Elsheikh’s mother has launched a separate legal challenge over the government’s decision to hand evidence to US authorities without seeking assurances he would not be executed.

The government says stripping citizenship is “particularly important in helping prevent the return to the UK of dual-national British citizens involved in terrorism-related activity in Syria or Iraq” but the power has also been extended to lower-level extremists and criminals, including Rochdale grooming gang members.

Mr Ansari told The Independent that it was being used “more, and more widely”.

Rochdale groomers Adil Khan, Abdul Aziz and Qari Abdul Rauf had their British citizenship removed (PA)

“There has been an increase in deprivation orders and the kind of cases they are being applied to – it’s not just national security,” he added.

“There is a lack of due process in the whole system … it’s the worst possible sanction to place on somebody, and trying to challenge it in this format is incredibly difficult.”

The government’s 2018 Transparency Report on Disruptive and Investigatory Powers said it “considers removal of citizenship to be a serious step, one that is not taken lightly”.

“Such action paves the way for possible immigration detention, deportation or exclusion from the UK and otherwise removes an individual’s right of abode in the UK,” it noted.

The report said the home secretary personally approves each use of the power “where it is considered that it may be conducive to the public good” over national security threats including espionage, terrorism and organised crime, or where British citizenship was obtained fraudulently.

While international law stipulates that people cannot be left stateless, the Immigration Act 2014 introduced a power allowing that to happen if a person has “acted in a manner seriously prejudicial to the vital interests of the UK”.

“This action may only be taken if the secretary of state has reasonable grounds for believing that the person is able, under the law of a country outside the UK, to become a national of that country,” the report said.

Of around 900 jihadis known to have travelled to the countries since 2014, the government estimates that 40 per cent have returned and 20 per cent have been killed in the region.