Hundreds of protesters at the University of California at Berkeley on Wednesday smashed windows, set fires and clashed with police as they forced a right-wing speaker to cancel his appearance at the liberal-leaning institution.

Two hours before far-right Breitbart News editor Milo Yiannopoulos was to give a speech at the student union, protesters tossed metal barricades and rocks through the building's windows and set a light generator on fire near the entrance, footage from news outlets showed.

11 PHOTOS Protest at UC Berkeley See Gallery Protest at UC Berkeley A worker surveys the damage to a vandalized Starbucks after a student protest turned violent at UC Berkeley during a demonstration over right-wing speaker Milo Yiannopoulos, who was forced to cancel his talk, in Berkeley, California, U.S., February 1, 2017. REUTERS/Stephen Lam BERKELEY, CA - FEBRUARY 1: People protesting controversial Breitbart writer Milo Yiannopoulos take to the streets on February 1, 2017 in Berkeley, California. A scheduled speech by Yiannopoulos was cancelled after protesters and police engaged in violent skirmishes. (Photo by Elijah Nouvelage/Getty Images) A vandalized Bank of America office is seen after a student protest turned violent at UC Berkeley during a demonstration over right-wing speaker Milo Yiannopoulos, who was forced to cancel his talk, in Berkeley, California, U.S., February 1, 2017. REUTERS/Stephen Lam Police officers prepare to deploy a skirmish line after a student protest turned violent at UC Berkeley during a demonstration over right-wing speaker Milo Yiannopoulos, who was forced to cancel his talk, in Berkeley, California, U.S., February 1, 2017. REUTERS/Stephen Lam TPX IMAGES OF THE DAY BERKELEY, CA - FEBRUARY 1: People protesting controversial Breitbart writer Milo Yiannopoulos burn trash and cardboard in the street on February 1, 2017 in Berkeley, California. A scheduled speech by Yiannopoulos was cancelled after protesters and police engaged in violent skirmishes. (Photo by Elijah Nouvelage/Getty Images) BERKELEY, CA - FEBRUARY 1: A protester is carried into a building by police officers during a protest on the UC Berkeley campus on February 1, 2017 in Berkeley, California. A speech by controversial Breitbart writer Milo Yiannopoulos, who was scheduled to speak at the university, was cancelled after protesters and police engaged in violent skirmishes. (Photo by Elijah Nouvelage/Getty Images) BERKELEY, CA - FEBRUARY 1: People protesting controversial Breitbart writer Milo Yiannopoulos march in the street on February 1, 2017 in Berkeley, California. A scheduled speech by Yiannopoulos was cancelled after protesters and police engaged in violent skirmishes. (Photo by Elijah Nouvelage/Getty Images) BERKELEY, CA - FEBRUARY 1: Damage is seen to a Chase Bank branch following a protest on February 1, 2017 in Berkeley, California. A speech by controversial Breitbart writer Milo Yiannopoulos, who was scheduled to speak at UC Berkeley, was cancelled after protesters and police engaged in violent skirmishes. (Photo by Elijah Nouvelage/Getty Images) BERKELEY, CA - FEBRUARY 1: A protester smashes the window of a Target store on February 1, 2017 in Berkeley, California. A speech by controversial Breitbart writer Milo Yiannopoulos, who was scheduled to speak at UC Berkeley, was cancelled after protesters and police engaged in violent skirmishes. (Photo by Elijah Nouvelage/Getty Images) The inside of a Chase Bank is seen after being vandalised by protesters in Berkeley, California on February 1, 2017. Violent protests erupted on February 1 at the University of California at Berkeley over the scheduled appearance of a controversial editor of the conservative news website Breitbart. / AFP / Josh Edelson (Photo credit should read JOSH EDELSON/AFP/Getty Images) A man pulls a piece of metal out of a window as a flare burns inside a Wells Fargo Bank in Berkeley, California on February, 1, 2017. A speech by Breitbart editor Milo Yiannopoulos scheduled at the University of Berkeley was cancelled after demonstrators set fires and threw objects at buildings to protest his appearance. / AFP / Josh Edelson (Photo credit should read JOSH EDELSON/AFP/Getty Images) Up Next See Gallery Discover More Like This HIDE CAPTION SHOW CAPTION of SEE ALL BACK TO SLIDE

Police ordered protesters to disperse as the school put the campus on lockdown. Protesters also tossed bricks and fireworks at police in riot gear who fired rubber pellets back at the crowd, according to SFGate.com, a news outlet in San Francisco.

"We shut down the event. It was great. Mission accomplished," a protester told CNN.

RELATED: Criminal offenses at University of California-Berkeley

"Obviously it's a liberal campus so they hate any libertarians or conservatives who dare to express an opinion on their campuses," he said. "They particularly don't like me."

(Reporting by Alex Dobuzinskis in Los Angeles, Brendan O'Brien in Milwaukee; Editing by Nick Macfie; Editing by Sandra Maler and Nick Macfie)