Jeremy Corbyn has told Sky News that convicted terrorists should "not necessarily" automatically serve their full prison sentences.
The Labour leader's comment comes in the wake of Friday's London Bridge terror attack, which left two people dead.
Sponsored link
The attacker, 28-year-old Usman Khan, was a convicted terrorist who was wearing an electronic tag after being released halfway through a 16-year prison sentence for plotting to bomb the London Stock Exchange.
Prime Minister Boris Johnson has said violent offenders "must serve every day of their sentence, with no exceptions".
Speaking to Sky's Sophy Ridge, Mr Corbyn said there were lessons to be learned from the incident and there should be a "full investigation" into the circumstances around the attacker's prison sentence and subsequent release.
Pressed on whether convicted terrorists should serve their full prison sentences automatically, he said: "No, not necessarily".
The Labour leader continued: "I think it depends on the circumstances and it depends on the sentence but crucially depends on what they've done in prison.
More from Jeremy Corbyn
General election: Corbyn promises 10 new national parks in green manifesto
General election: 'Bombshell' documents do little to back up Corbyn's accusations
General election: Corbyn produces 'evidence' NHS is 'up for sale' under Tories
General election: Chief rabbi's suggestion Corbyn is 'unfit for high office' is unprecedented
General election: TV showpieces prove public yet to be convinced by party leaders
General election: Jeremy Corbyn to stay neutral in second Brexit referendum
"I think there has to be an examination of how our prison services work and crucially what happens to them on release from prison."
He added: "There has to be an examination of what goes on in the prison, because prisons ought to be a place where people are put away because of major serious offences but also a place where rehabilitation takes place."
Mr Corbyn said police "had no choice" but to shoot Khan dead as they were "stuck with a situation where there was a credible threat of a bomb belt around his body".
Speaking later at an event in York, he said people cannot be kept safe "on the cheap".
London Bridge attack: Boris Johnson says terrorists must serve 'every day of sentences'
Mr Corbyn added: "We have to understand that no government can prevent every attack. No-one would believe any political leader who said they could. But the government can act to make such acts of terror less, rather than more, likely."
His remarks follow the prime minister's assertion that automatic early release must end and other laws must change to strengthen security.
Mr Johnson claimed that because the "broken hung parliament was preoccupied with blocking Brexit", his government was unable to make the changes required to keep violent offenders and terrorists in jail for longer.
He said: "This system has got to end - I repeat, this has got to end, as I've been saying for four months."
"If you are convicted of a serious terrorist offence, there should be a mandatory minimum sentence of 14 years - and some should never be released.
"Further, for all terrorism and extremist offences the sentence announced by the judge must be the time actually served - these criminals must serve every day of their sentence, with no exceptions.
"These simple changes, in line with what I've been saying since becoming prime minister, would have prevented this attack."
The PM told the BBC's Andrew Marr he found it "repulsive" that terrorists like Khan could be released from prison after serving eight years.
He added that there were "probably about 74" others subject to early release after terror offences, cases that are now being "properly invigilated" to "make sure there is no threat".
Mr Johnson also sought to blame Labour for the release of Khan, saying: "The reason this killer was out on the streets was because of automatic early release which was brought in by a leftie government."
It comes after the father of Jack Merritt, the 25-year-old who was killed in Friday's attack, urged politicians not to enforce "draconian" sentences.
According to CambridgeshireLive, David Merritt said: "My son, Jack, who was killed in this attack, would not wish his death to be used as the pretext for more draconian sentences or for detaining people unnecessarily.
"R.I.P. Jack: you were a beautiful spirit who always took the side of the underdog."
Law student Jake Thorold, who knew Jack Merritt from the Learning Together prison rehabilitation programme, accused "shameless" politicians of "attempting to use his death to legitimate draconian sentencing changes".
He wrote on Twitter: "The awful actions of the perpetrator of Jack's death should of course not be minimised.
"But when he is pointed to as justification for an evermore uncaring justice system, the values that @JustisTogether have championed should be fought for even harder."
Liberal Democrat Ed Davey accused Mr Johnson of "politicising" the attack.
"In the middle of an election, we shouldn't be making political capital out of a tragedy, and he's doing that, and he's doing that in a way which is misleading people about what the law actually says," he told Sky's Sophy Ridge on Sunday.
When David Merritt's comments were put to Dominic Raab, the foreign secretary told the same programme: "No one wants to see the politicisation of this."
Khan's sentence was quashed at the Court of Appeal in April 2013 and he was given a determinate 16-year jail term, with a five-year extended licence period, under legislation which meant he was released automatically halfway through the sentence.
Sentencing law changed in 2012, and if Khan was given the same sentence today, he would have had to serve at least two-thirds and be released only if the Parole Board agreed.
The Parole Board said it had no involvement in his release and that Khan "appears to have been released automatically on licence" halfway through his sentence.
The Ministry of Justice says it will be reviewing the licence conditions of every terrorist offender to make sure they are "as tough as they need to be".
It adds the review is being undertaken to "guarantee public safety rather than because of any particular concern".