Hong Kong police have used tear gas and batons to fight off protesters as they tried to break through a cordon that is trapping hundreds on a university campus.

Protesters advanced on the police from outside the cordon, while others emerged from the Hong Kong Polytechnic University campus. Police used tear gas and in some places swooped in to subdue protesters and make arrests.

Protesters have fortified the campus for days to stop police from getting in. They are now trying to get out after being cornered by authorities.

READ MORE: Hong Kong’s long day of rage

Officers repelled one attempt on Monday morning with tear gas, driving a few hundred protesters back onto the campus.

Protesters won on a legal front when the high court struck down a mask ban imposed by the government last month. The court said it did not consider anti-mask laws unconstitutional in general, but in this case, the law infringed on fundamental rights further than was reasonably necessary.

Hong Kong ProtestsA policeman in riot gear points his weapon as protesters try to flee from the Hong Kong Polytechnic University (Ng Han Guan/AP)

Many protesters wear masks to shield their identities from surveillance cameras that could be used to arrest and prosecute them. The ban has been widely ignored, and police have charged protesters with wearing masks.

The protests started peacefully in early June, sparked by proposed legislation that would have allowed criminal suspects to be extradited to the mainland. But by the time the bill was withdrawn, the protests had hardened and broadened into a resistance movement against the territory’s government and Beijing.

READ MORE: Hong Kong police shoot teenager at close range

Activists see the extradition bill as an example of Hong Kong’s eroding autonomy under Beijing rule since the 1997 handover from colonial power the UK.

The head of a nationalistic Chinese newspaper said Hong Kong police should use snipers to fire live ammunition at violent protesters.

Hong Kong ProtestsPolice in riot gear drag a protester who was trying to flee from the Hong Kong Polytechnic University (Ng Han Guan/AP)

“If the rioters are killed, the police should not have to bear legal responsibility,” Global Times editor Hu Xijin wrote on his Weibo social media account.

Anti-government protesters barricaded themselves inside Polytechnic last week. Police surrounded the area on Sunday night and began moving in after issuing an ultimatum for people to leave the area. The crowd wore raincoats and carried umbrellas to shield themselves from police water cannons.

Riot officers broke in one entrance before dawn as fires raged inside and outside the school, but they did not appear to get very far. Fiery explosions were seen as protesters responded with petrol bombs. Police, who have warned that everyone in the area could be charged with rioting, reportedly made a handful of arrests.

At daybreak, protesters remained in control of most of the campus.