A judge has 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 more than 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 the Conservative Party's 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: "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."

He 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: "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 on Monday : "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."

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, he said: "I was absolutely not intending that anyone in any way would be hurt. Very soon afterwards, I realised it was something I should not have done. I regret bitterly what I did."