Michael Adebolajo has been given a whole-life term and Michael Adebowale has been jailed for a minimum of 45 years for murdering Fusilier Lee Rigby.
Adebolajo, 29, and Adebowale, 22, drove into Fusilier Rigby with a car before hacking him to death in Woolwich, south-east London, in May last year.
The judge, Mr Justice Sweeney, said Adebolajo's was one of those "rare cases" warranting a whole-life term.
The pair were absent during sentencing after a fracas in the dock.
As Mr Justice Sweeney began to sentence the men they started shouting and scuffling with court security guards. They had to be forced to the ground and were removed from court.
Fusilier Rigby's family wept as Adebolajo shouted "Allahu Akbar", and Adebowale called out "that's a lie" as the judge told them their extremist views were "a betrayal of Islam".
One relative needed medical treatment after the outbursts. The judge later apologised for the fact that the family had to witness what happened in the dock.
Sentencing the killers in their absence, the judge said they had been convicted on "overwhelming" evidence of the "barbaric" murder of Fusilier Rigby.
The British Muslim converts had "butchered" the 25-year-old soldier, he said.
Adebolajo was the leader of the "joint enterprise", the judge said, but Adebowale played his part "enthusiastically".
Mr Justice Sweeney said the pair carried out the murder "in a way that would generate maximum media coverage".
"He had done absolutely nothing to deserve what you did to him", the judge said. The pair created "a bloodbath", he went on, adding: "You both gloried in what you had done.
"Your sickening and pitiful conduct was in stark contrast to the women at the scene who tended to Lee Rigby's body and challenged what you had done."
Speaking outside court, Det Insp Pete Sparks, police liaison officer for Fusilier Rigby's family, read a short statement on behalf of the family saying "no other sentence would have been acceptable".
"We feel satisfied that justice has been served for Lee", the statement said.
Home Secretary Theresa May said the sentences showed "extremist behaviour of any kind will never be tolerated in Britain".
"Our thoughts are of course with Lee Rigby's family, who have endured unimaginable heartbreak over the last nine months. I hope they will take some comfort from this judgment."
Sue Hemming, head of special crime and counter terrorism at the Crown Prosecution Service, said Adebolajo and Adebowale had "revelled in one of the most appalling terrorist murders I have seen".
"Not only was the attack brutal and calculated; it was also designed to advance extremist views," she said.
And Assistant Commissioner of the Metropolitan Police, Cressida Dick, said the sentences reflected the "true horror" of Fusilier Rigby's murder.
Earlier, Fusilier Rigby's wife Rebecca said her young child would grow up to see images "no son should have to endure".
Her statement was one of those from Fusilier Rigby's family, read out by prosecutor Richard Whittam QC ahead of the sentencing.
Mrs Rigby said she had accepted her husband's life would be at risk when he was deployed to Afghanistan, but not when he was at home.
"When you wave someone off you accept that there is a chance you will never see them again. You do not expect to see this on the streets of the UK," she said.
The court also heard part of a statement from the soldier's stepfather, Ian Rigby.
He said: "After all he'd been through in Afghanistan, all Lee was doing was walking through London. After seeing the television, you just can't comprehend it."
Adebolajo and Adebowale faced whole-life jail terms after a Court of Appeal ruling last week upheld judges' right to jail the most serious offenders in England and Wales for the rest of their lives.
Earlier during the hearing, counsel for Adebolajo, David Gottlieb, warned an indeterminate sentence could "create a martyr".
Mr Gottlieb also said Adebolajo was "not so depraved or wicked that he is incapable of redemption", adding the murder "shares the characteristics of a religiously aggravated crime".
He said Adebolajo had intended to die and still believed he should be put to death.
Adebolajo had claimed he was a "soldier of Allah" and the killing was an act of war.
But Mr Justice Sweeney rejected his mitigation, saying Adebolajo had "no real prospect of rehabilitation".
Counsel for Michael Adebowale, Abbas Lakha QC, told the court the killing was "horrific" but was not a case "where the offending is so exceptionally high that Mr Adebowale must be kept in prison for his life".
He said: "The right and proper sentence is one which does leave open the possibility of release in the future. Any other sentence would be inhuman."
Addressing Adebowale during sentencing, the judge said: "I am persuaded that the combination of your lesser role, your age and your pre‐existing and continuing mental condition mean that it is not appropriate in your case to impose a whole-life term."
Fusilier Rigby, from Middleton, Greater Manchester, was murdered as he returned to his barracks in Woolwich, south-east London on 22 May 2013. He died of multiple cut and stab wounds.
Adebolajo and Adebowale drove into Fusilier Rigby at 30 to 40mph, before dragging him into the road and attacking him with knives and attempting to decapitate him with a meat cleaver.
Outside court, three people were arrested as far-right protesters gathered while the pair were being sentenced.
Supporters of the British National Party and the English Defence League gathered around a makeshift gallows constructed in the street and held placards calling for the capital punishment to be restored.
Protesters cheered when the sentences were announced.
A City of London Police spokesman said two men were arrested, one on suspicion of actual bodily harm and one for affray.
A woman was also arrested on suspicion of being drunk and disorderly.