Students at a Hong Kong university turned their graduation ceremony into an anti-government protest Thursday by donning masks along with their caps and gowns.

The demonstration by graduates at the Chinese University of Hong Kong defied a government ban on wearing masks which was implemented last month to control protests that have turned increasingly violent.

The students were defending their rights to freedom of expression and speech — rights that they fear are being chipped away by Beijing's control over the territory, Anson Yip, vice president of the university's student union, told NBC News.

"We are not controlling ourselves, we are controlled by the Chinese government. This is the cause of everything," Yip, 20, who is studying journalism and communications, said.

Censorship by the government in Beijing is among the issues Yip said students are fighting against.

Prior to Thursday's ceremony, students at the university had put posters on the campus overnight with slogans and messages calling for Hong Kong's freedom. Posters that specifically targeted the Beijing government were removed by the morning by the university, she said.

The university didn't specifically address the issue of the posters, but said in a statement that "campus facilities and ceremony venue were maliciously defaced by some people."

The university also cut short the ceremony once all students were conferred their diplomas, the statement said. Teaching and research awards that had yet to be presented will be distributed at a rescheduled event.

But before the event ended, the university's president and vice-chancellor Rocky Tuan addressed the political unrest in his speech to the graduates.

"You are graduating at a time of unrest and uncertainty as the city faces one of its biggest challenges in history. Polarized views, mistrust and conflicts have arisen from deep-seated social problems," he said. "We should respect other people's rights to express themselves freely."

University students wearing Guy Fawkes masks during a protest before their graduation ceremony at the Chinese University of Hong Kong on Thursday. Kin Cheung / AP

Protests in Hong Kong began in June over a now-withdrawn extradition bill, but have since morphed to include calls for greater democratic freedoms.

The former British colony has retained its own economic and administrative systems after being handed over to China in 1997 through a "one country, two systems" model.

There is a clear divide between the political culture in Hong Kong and the mainland, which local residents like herself want to see maintained, Yip said. "People’s mindset in Hong Kong, our core values are democracy, freedom, liberty, but in China, the Chinese people, they don't fight for these kinds of ideology."

That divide is also causing tensions on campus.

Students and alumni involved in a march earlier in the morning on the campus converged with the hundreds of graduates, Yip said. But not all those present agree with the anti-government sentiment.

One student speaking Mandarin — the language of the mainland — wielded a small knife and argued with protesters, Yip said.

A video of the incident taken by the campus radio station ahead of the graduation ceremony shows the male student singing the Chinese national anthem at a group of students carrying protest banners. The student claimed he was carrying a knife to prevent any attacks from the protesters, said Brian Chan, 19, a student and a volunteer with the campus radio station.

The student placed the knife down on the ground before talking to the media, the video showed. He was eventually taken away by campus security, Chan said over Instagram messenger.

Although no students were arrested at the demonstration, according to Yip, others have been detained by police over the mask ban in the city, fueling students' desire to continue demonstrating.

"Wearing a mask is like showing my opinion," she said. "We are really firm on this issue, we will never stand down."