A judge praised the mother of a sixth-former who admitted throwing a fire extinguisher from a roof during an anti-fees riot as he locked up the teenager for over two years.
Judge Geoffrey Rivlin QC told Edward Woollard, 18, he was taking into account his mother's "extraordinary and courageous conduct" in persuading him to give himself up.
But sentencing him to two years and eight months in a young offenders' institution, the judge said the public had a right to protection from violence.
Woollard, of Dibden Purlieu, Hampshire, joined protesters who stormed the Millbank complex in London that houses Tory Party headquarters on November 10.
His mother Tania Garwood encouraged him to give himself up to police after he was pictured by media organisations during the rioting.
The judge told the teenager, who threw the metal fire extinguisher from a seventh-floor rooftop as hundreds of people gathered below, that he would serve at least half his sentence for violent disorder.
The judge said: "It is deeply regrettable, indeed a shocking thing, for a court to have to sentence a young man such as you to a substantial term of custody.
"But the courts have a duty to provide the community with such protection from violence as they can and this means sending out a very clear message to anyone minded to behave in this way that an offence of this seriousness will not be tolerated.
"The right of peaceful protest is a precious one. Those who abuse it and use the occasion to indulge in serious violence must expect a lengthy sentence of immediate custody."
The judge added: "Nevertheless I shall take into account in your favour the extraordinary and courageous conduct of your mother, which resulted in you giving yourself up to the police so quickly."
The judge also said he took into account the defendant's age, his guilty plea at the earliest opportunity and the fact that he had no previous convictions.
Woollard's mother, who was joined in the packed court room at Southwark Crown Court by friends and relatives, broke down in tears as her son was sentenced.
The judge told him: "It is perhaps ironic that the weapon which you threw down from the top of this very high building and which was calculated to inflame passions was a fire extinguisher.
"I have seen the DVD recording of this crime. There was a large crowd of people on the ground beneath.
"The televised recording of the incident shows that this heavy fire extinguisher fell terrifyingly close to a group of police officers - just a few feet away.
"It is my judgment, exceedingly fortunate that your action did not result in death or very serious injury either to a police officer or a fellow protester."
The student, dressed in a dark suit, shirt and tie, sat with his head bowed at times as his sentence was handed down.
He was told the maximum sentence he could have received was one of five years but the judge said this was reduced owing to his guilty plea.
His mother declined to comment afterwards but said earlier that he deserved to be punished.
Ms Garwood, 37, said she feared the incident had ruined his life, telling The Times yesterday: "I brought up my children to take responsibility for their actions and he has. I believe he deserves to be punished. I just hope it is the right punishment.
"He is a loving, caring, gentle man. He has got a lot to give, he has got a lot to learn. I hope he has got the chance to continue his education and it hasn't ruined his life."
Woollard was studying A-levels at Brockenhurst College at the time of the offence.
He was one of hundreds of students who split away from a huge protest and gathered outside Tory party headquarters. Several dozen people smashed their way inside the complex, breaking furniture and windows, while others chanted and lit fires outside.
As a four-hour stand-off unfolded, several dozen protesters gathered on the roof, discharging fire extinguishers on to the crowd below.
Woollard was arrested five days later when he gave himself up to police after footage of the incident was shown on television.
More than 54 people involved in widespread disorder and criminal damage on November 10 have been arrested and police have released images of some suspects.
The court was told Woollard, who had just turned 18, became embroiled in violence some half an hour after entering the Millbank complex, where he made his way on to the roof.
The teenager, who had been on his first trip to London without an accompanying adult, spotted another protester emptying a fire extinguisher and seized his opportunity.
Prosecutor Peter Zinner said: "As the fellow demonstrator is seen to shake the extinguisher and as the spray ceases, he deliberately swings the extinguisher to his right at police in what the Crown would say was a deliberate dangerous and reckless act with a view to causing the police below harm."
In dramatic CCTV footage played to the court, the canister is seen hurtling towards the ground, prompting shouts from those beneath.
Mr Zinner said police in the courtyard below were forced to take "evasive action" to avoid being struck by the missile, which landed "no more than a metre from the officers".
"The impact of the whole incident on police officers concerned was marked," he said.
"Had that fire extinguisher struck a police officer or anyone, it would almost certainly have caused serious harm or death."
In a police statement read to the court, Woollard apologised for his actions, saying: "When I was told I had potentially endangered people, I felt sick."
Recalling his behaviour that day, he said: "Someone partially emptied a fire extinguisher, I then took the fire extinguisher and I emptied the rest.
"When the extinguisher was emptied, I lobbed it to go into a gap in the crowd below.
"I was absolutely not intending that anyone in anyway would be hurt.
"Very soon afterwards, I realised it was something I should not have done. I regret bitterly what I did."
The student, who hoped to be the first member of his family to go on to higher education, attended the protest with friends from his sixth-form college, travelling to London by coach.
His barrister, Hossein Zahir, said Woollard acted in a "moment of madness" and the offence had "jeopardised his future and prospects".
"This represents a genuine tragedy," Mr Hossein said.
"Never for a moment had it crossed his mind to be involved with violence or disorder - it was inconceivable."
He stressed that the student had not been involved in the rest of the widespread disorder that day and had not caused damage as students entered Millbank.
Woollard was "high-spirited and excited" as he sprayed the extinguisher before launching it several storeys below, he added.
"In a moment of madness, this man of good character threw it in a gap between police officers and supporters," he told the court.
"He wasn't targeting police officers and he wasn't intending to cause injury."
Describing the crime as "repulsive", Mr Hossein said Woollard was "horrified at what he did" and had simply become "caught up in the moment".
Woollard handed himself in to police when he spotted himself on Sky News and went to his mother.
Friends and relatives in the public gallery comforted each other and fought back tears throughout the hearing.
Before sentencing, the judge retired for 15 minutes and Woollard, who has 10 GCSEs, was given a chance to speak to his relatives.
He embraced his mother, who whispered to him before the sentence was delivered.
In a statement, Brockenhurst College said: "The college views what occurred as extremely serious and Edward Woollard has been on permanent exclusion since the incident.
"The college will be making no further statement."
Earlier the court heard the demonstration, organised by the National Union of Students (NUS), was designed to be a peaceful protest but descended into increasingly violent clashes in the early afternoon.
At around 2.30pm, a splinter group of around 1,000 people forced their way into the courtyard of Millbank tower.
Ordinary officers, who were pelted with missiles, were left "in fear for their lives", Mr Zinner told the court.
Later they were hit with foam sprayed from the 6kg (13lb) extinguisher before Woollard launched it from the roof in what his barrister described as an "unplanned and spontaneous act".
He went on to make a full admission to police.
David Morris, MP for Morecambe and Lunesdale, said: "This sends out a very strong message and is encouraging for everyone who thinks that violence should have no part in our political debate.
"Edward Woollard endangered the lives of police, the public and his fellow protesters. This sentence is richly deserved and I hope he will spend the next two years and eight months reflecting on how dangerous and irresponsible his behaviour that day was.
"He should feel ashamed of himself."Reuse content