The British government on Tuesday defended proposals to extend prison sentences of convicted terrorists after two knife rampages in London - despite warnings it could face a challenge in court.Justice Secretary Robert Buckland on Monday promised "emergency legislation" to end the automatic release of terror offenders half-way through their sentences.That followed attacks by two men on early release on Sunday in the Streatham area of south London and near London Bridge in November. Both attackers were shot dead by police. Two people were stabbed to death in November and the latest stabbing injured three.Prime Minister Boris Johnson wants to raise the minimum time served to two-thirds of the sentence and have a parole board review and approve every early release.That could keep dozens of convicts up for release this year behind bars.Senior cabinet minister Michael Gove maintained that some terrorist offenders should be imprisoned indefinitely "if necessary"."Until we know that they are comprehensively de-radicalised and that it is safe to have those people on our streets then public protection must come first," Gove told Sky News television.But Alex Carlile -- a respected legal expert who served as an independent reviewer of anti-terror legislation -- said the new proposals "may have gone too far"."The decision to lengthen the sentences of people who have already been sentenced, and therefore expected to be serving half the sentence the judge imposed upon them, may be in breach of the law," Carlile told BBC television on Monday night."It's certainly going to be challenged."The main opposition Labour party's justice spokesperson Shami Chakrabarti - a former head of rights group Liberty - also expressed concern.She said the government was "going to go down the road of punishment without trial or extending sentences of people who have already been sentenced."An unnamed government source told the Politico news site that Johnson's team was "quite willing to have that battle with the lawyers".Public support Johnson appears to have the public on his side.A YouGov poll conducted before Sunday's attack indicated that nine in 10 respondents backed life sentences for terror offenders "if the circumstances are serious enough".The south London attack by 20-year-old Sudesh Amman dominated newspaper coverage for the second day running.A former prisoner who claimed to have served time with Amman was quoted as saying by The Times that the "guy was definitely insane and he never hid his intentions, so it's crazy how he even got out of jail".Debates over terror legislation are not new to Britain.Prime minister David Cameron and his interior minister Theresa May in 2011 scrapped measures introduced under the previous Labour government because they were "excessive and unnecessary".Those included "control orders" allowing security services to monitor and restrict the movements of people considered a terrorist threat but with insufficient evidence to charge them.Conditions included nightly curfews of up to 16 hours and restrictions on their use of the telephone and internet.Critics likened the system to house arrest.May opted for more targeted measures after succeeding Cameron as prime minister in 2016.But Carlile told Britain's domestic Press Association news agency that Johnson should re-introduce the control orders because they could tackle the "immediate problem".