The university said security precautions for the event, which involved officers from eight different law enforcement agencies, cost $800,000.

Along with far-right author Mike Cernovich and anti-Muslim figure Pamela Geller, Yiannopoulos addressed around 150 supporters who had gathered to hear him speak.

“It feels like probably the most expensive photo op in the university’s history,” said UC Berkeley spokesman Dan Mogulof, according to The Mercury News.

The sum spent on security for Yiannopoulos is likely to anger some members of the UC Berkeley community.

In August, Carol Christ, chancellor of the university, announced budget cuts to the tune of more than $20m for the 2017-2018 academic year.

In April 2016, Nicholas Dirks – who was then chancellor – disclosed that at least 500 staff members would be laid off over a two-year period.

Sunday’s small rally was announced a day after Berkeley Patriot, the right-wing student group behind “Free Speech Week”, cancelled the larger, four-day event.

Former White House strategist Steve Bannon, right-wing pundit Ann Coulter and British media personality Katie Hopkins, among others, had earlier been slated to speak.

The cancellation followed a string of speakers pulling out and accusations by the university that Berkeley Patriot had missed deadlines to secure some of the requested venues.

“It is extremely unfortunate that this announcement was made at the last minute, even as the university was in the process of spending significant sums of money and preparing for substantial disruption of campus life in order to provide the needed security for these events,” UC Berkeley’s Mogulof said in a statement.

Berkeley Patriot’s lawyer, Marguerite Melo, has accused the university of “viewpoint discrimination” and provided a copy of a letter to the university’s interim vice chancellor, Stephen Sutton.

In the letter, Melo alleged that “the student group has been subjected to extraordinary pressure and resistance, if not outright hostility, by the UC Berkeley administration and your employees”.