A student who admitted throwing a fire extinguisher from the roof of Millbank Tower during November's tuition fees protests was sentenced to 32 months in jail today by a judge who warned those who abuse the right of peaceful protest to expect lengthy custodial sentences.

Edward Woollard, 18, joined protesters who stormed the complex that houses the Conservative party headquarters in London on 10 November.

Footage showed him hurling an empty metal fire extinguisher from the roof of the seven-storey building. It landed close to hundreds of protesters and police in a courtyard below.

The A-level student, from Dibden Purlieu, Hampshire, will serve half of the sentence in a young offenders' institution before being eligible for release.

His head slumped down as judge Geoffrey Rivlin QC told him he was "exceedingly fortunate" his action did not result in death or serious injury to others.

"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," said Rivlin, "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.

"If ever a case calls for a deterrent sentence, this is it," Rivlin told Woollard. "I wish to stress, however, that this is not a case of making an example of you alone. Anyone who behaves in this way and comes before the courts must expect a long sentence of custody."

Members of Woollard's family and friends packed into the public gallery at Southwark crown court were visibly distressed as the teenager was taken down. Minutes earlier, he had embraced his emotional mother, Tania Garwood, 37, who whispered to him before he entered the dock to hear his sentence.

His barrister, Hossein Zahir, said Woollard "bitterly regretted" and was "mortified" by his action, the result of a "short-lived, very swiftly repented single moment of madness".

It was a "genuine tragedy" for Woollard, who was set to become the first member of his family to attend higher education. "In a matter of a few seconds, he had jeopardised future prospects and brought havoc to his life and the lives of those he loved," Zahir said.

The court heard that Woollard, who pleaded guilty to violent disorder, had turned 18 a month before the incident and was one of about 1,000 students who split away from the huge protest to gather outside the Tory HQ. Several dozen smashed their way into the complex, breaking furniture and windows as the police "seemed unprepared or outnumbered".

The court fell silent as video footage was played showing Woollard, identified by his distinctive hair, on the roof of Millbank Tower.

He was seen picking up the half-empty canister, discarded by another student, before spraying the crowd below and then throwing it in the direction of police beneath. Other footage showed it hurtling from the roof to land with a heavy, audible thud within a metre of police officers.

Prosecutor Peter Zinner said it was "a deliberate, dangerous and reckless act with a view to causing the police harm".

"The impact the incident had on the police officers concerned was marked. No doubt, the officers were put in some considerable fear of their lives."

Woollard gave himself up, encouraged by his mother, after footage of the incident was shown on Sky News. In a statement to police, read to the court, he said: "When I was told I had potentially endangered people, I felt sick." He said he had "lobbed it [the extinguisher] 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 court heard he had travelled to London by coach to attend the protest with friends from Brockenhurst college. It was his first visit to the capital unaccompanied by an adult.

Zahir said Woollard was in "high spirits", "excited" and had got "carried away". Immediately afterwards, though, he withdrew from the protest and was "shocked, dazed and horrified" at what he had done.

About 30 testimonials were submitted from his family and others who testified to his previous good character.

The judge said he took into account "the many fine references" and the "extraordinary and courageous conduct" of his mother that resulted in Woollard giving himself up, but insisted it was a case of "serious criminal violence creating a situation of grave danger to others".

He said Woollard's main motivation "was to create a sense of disturbance, anarchy and antisocial behaviour" to draw attention of the political cause of the march.

Commander Bob Broadhurst, the Metropolitan police's head of public order, said: "We all recognise and respect the fundamental right to peaceful protest. That is why we go to such lengths to engage with demonstration organisers before and during these events.

"What we, the police, and those who live and work in London cannot and will not tolerate is violence against members of the public or police officers, or damage to property."This sentence is a significant period of imprisonment for a young man with no previous convictions. It will have a significant impact on his life and his future."