President Xi Jinping hailed China's rule over Hong Kong on Friday as he led 25th anniversary celebrations of the city's handover from Britain, insisting that democracy was flourishing despite a years-long political crackdown that has silenced dissent.

Xi's speech was the finale of a two-day victory lap aimed at celebrating the Chinese Communist Party's control over the once outspoken business hub after authorities stamped out huge democracy protests.

Since Beijing imposed a national security law on Hong Kong in 2020, opposition has been quashed and most leading pro-democracy figures have fled the country, been disqualified from office or jailed.

But Xi said Beijing had always acted "for the good of Hong Kong".

China's President Xi Jinping's visit to Hong Kong is a chance for the Chinese Communist Party to showcase its power over the city
China's President Xi Jinping's visit to Hong Kong is a chance for the Chinese Communist Party to showcase its power over the city POOL via AFP / Selim CHTAYTI

"After reuniting with the motherland, Hong Kong's people became the masters of their own city," he said. "Hong Kong's true democracy started from here."

The tightly choreographed trip is the Chinese leader's first outside of the mainland since the beginning of the Covid-19 pandemic and his first to Hong Kong since the massive protests overwhelmed the city in 2019.

Friday's ceremony included the inauguration of the city's new government, led by John Lee -- a former security chief who oversaw the police response to those demonstrations.

"After all the storms, everyone has painfully learned that Hong Kong can't fall into chaos and Hong Kong can't afford chaos," Xi said.

Graphic charting visits by China's leaders to Hong Kong at times of handover anniversaries
Graphic charting visits by China's leaders to Hong Kong at times of handover anniversaries AFP / STAFF

"It must get rid of all disturbances and focus on development."

Friday marks the halfway point of the 50-year governance model agreed by Britain and China under which Hong Kong would keep autonomy and key freedoms, known as One Country, Two Systems.

The anniversary used to be a prime example of those freedoms in action.

Chinese President Xi Jinping's visit to Hong Kong is taking place under a tightly monitored closed loop system
Chinese President Xi Jinping's visit to Hong Kong is taking place under a tightly monitored closed loop system AFP / Peter PARKS

For years after the handover hundreds of thousands of residents would take part in a march every July 1 to voice political and social grievances.

But that rally, like all other mass gatherings and protests in Hong Kong, has been banned for more than two years.

Critics, including many western powers, say Beijing has effectively torn up the promise that Hong Kong would retain its way of life after the handover.

"We made a promise to the territory and its people and we intend to keep it, doing all we can to hold China to its commitments," British Prime Minister Boris Johnson said Thursday.

The city's main newspapers ran all-red full front pages celebrating the anniversary
The city's main newspapers ran all-red full front pages celebrating the anniversary AFP / DALE DE LA REY

The United States and Australia also issued statements timed for the anniversary criticising the erosion of freedoms while Taiwan's Premier said freedom and democracy had "vanished" in Hong Kong.

But Xi insisted that One Country, Two Systems was "a good system".

It "has no reason at all to change and it must be upheld in the long run," he said in his speech, arguing it safeguarded "the country's sovereignty, security and development interests".

China still maintains strict zero-Covid controls and Xi's visit took place under a tightly monitored "closed-loop" system to protect him.

Those coming into the president's orbit -- from the schoolchildren who welcomed him at the train station to the highest-ranking government officials -- were made to take daily PCR tests and spend days in a quarantine hotel.

Parts of the city were closed off, and media coverage was tightly restricted.

Police moved to eliminate any potential source of embarrassment during Xi's time in the city, with national security police making at least nine arrests over the past week, and many of the few remaining opposition groups saying they had been warned off protesting.

Authorities have sought to portray an image of public support for the celebrations.

The city's main newspapers ran all-red full front pages celebrating the anniversary, and pro-Beijing publications ran bumper editions full of advertisements, with the longest running to 188 pages.

Friday's celebrations began with a flag-raising ceremony at the city's Victoria Harbour, complete with a military flypast and a flotilla spraying plumes of water.

Xi was not present -- local media reported he had spent the night in the neighbouring mainland city of Shenzhen and travelled back into the city on Friday morning.

All events have been closed to the public, but some scattered groups gathered near the flag-raising ceremony to watch the flypast.

Liu, a 43-year-old restaurant worker, was among those who snapped pictures on her phone as the helicopters, trailing massive Chinese and Hong Kong flags, roared past.

"Our motherland has taken good care of us and we are thankful," she said. "I'm hopeful for the next 25 years."

In a nearby eatery, a 35-year-old tech worker surnamed Cheng said he had no special plans to mark the day.

"For me and I think some Hong Kongers, the biggest impact we feel is (Xi's) visit causing huge traffic jams everywhere."