HONG KONG (Reuters) - Chinese President Xi Jinping swore in Hong Kong’s new leader on Saturday with a stark warning that Beijing won’t tolerate any challenge to its authority in the divided city as it marked the 20th anniversary of its return from Britain to China.

Police blocked roads, preventing pro-democracy protesters from getting to the harbor-front venue close to where the last colonial governor, Chris Patten, tearfully handed back Hong Kong to China in the pouring rain in 1997.

Xi said Hong Kong should crack down on moves towards “Hong Kong independence”.

“Any attempt to endanger China’s sovereignty and security, challenge the power of the central government ... or use Hong Kong to carry out infiltration and sabotage activities against the mainland is an act that crosses the red line and is absolutely impermissible,” Xi said.

He also referred to the “humiliation and sorrow” China suffered during the first Opium War in the early 1840s that led to ceding Hong Kong to the British.

Hong Kong has been racked by demands for full democracy and, more recently, by calls by some pockets of protesters for independence, a subject that is anathema to Beijing.

Xi’s speech was his strongest yet to the city amid concerns over what some perceive as increased meddling by Beijing, illustrated in recent years by the abduction by mainland agents of some Hong Kong booksellers and Beijing’s efforts in disqualifying two pro-independence lawmakers elected to the city legislature.

“It’s a more frank and pointed way of dealing with the problems,” said former senior Hong Kong government adviser Lau Siu-kai on Hong Kong’s Cable Television. “The central government’s power hasn’t been sufficiently respected... they’re concerned about this.”

The tightly choreographed visit was full of pro-China rhetoric amid a virtually unprecedented security lockdown close to the scene of pro-democracy protests in 2014 that grabbed global headlines with clashes and tear gas rising between waterfront skyscrapers.

Slideshow ( 23 images )

Xi did not make contact with the people in the street or with any pro-democracy voices, forgoing an opportunity to lower the political heat through a softer, more nuanced approach.

The hardening stance of the democrats and Beijing could perhaps widen, spawning greater radicalism, though some activists also concede a spreading disillusionment has sapped momentum among the democracy movement since Xi came to power.

Under the mini-constitution, the Basic Law, Hong Kong is guaranteed wide-ranging autonomy for “at least 50 years” after 1997 under a “one country, two systems” formula praised by Xi. It also specifies universal suffrage as an eventual goal.

But Beijing’s refusal to grant full democracy triggered the nearly three months of street protests in 2014 that posed one of the greatest populist challenges to Beijing in decades.

“MOST URGENT” PROTEST IN YEARS

In the afternoon, tens of thousands gathered in sweltering heat in a sprawling park named after Britain’s Queen Victoria, demanding Xi allow universal suffrage. Organizers put the figure at more than 60,000.

“Xi shouldn’t be interfering in Hong Kong too much,” Peter Lau, a 20-year-old university student, said. “Despite him visiting garrisons and muscle-flexing, Hong Kong people’s confidence will never be shaken. Especially for our generation. We should ... fight for our freedom.”

Some demonstrators marched with yellow umbrellas, a symbol of democratic activism in the city, and held banners denouncing China’s Communist “one party rule”.

Slideshow ( 23 images )

Others criticized China’s Foreign Ministry which on Friday said the “Joint Declaration” with Britain over Hong Kong, a treaty laying the blueprint over how the city would be ruled after 1997, “no longer has any practical significance”.

At the end of the rally a simple white banner read: “Cry in grief for 20 years.”

[For a link to Reuters handover stories, reut.rs/2sje26J]

Xi in the morning addressed a packed hall of mostly pro-Beijing establishment figures, after swearing in Hong Kong’s first female leader, Carrie Lam, who was strongly backed by China.

Xi hinted that the central government was in favor of Hong Kong introducing “national security” legislation, a controversial issue that brought nearly half a million people to the streets in protest in 2003 and ultimately forced former leader Tung Chee-hwa to step down.

A small group of pro-democracy activists near the venue were roughed up by a group of men who smashed up some props in ugly scuffles. Nine democracy protesters, including student leader Joshua Wong and lawmaker “long hair” Leung Kwok-hung, were bundled into police vans while several pro-China groups remained, cheering loudly and waving red China flags.

The activists, in a later statement, said the assailants had been “pro-Beijing triad members”.