President Xi Jinping arrived in Hong Kong on Thursday to mark 20 years since its return to China by Britain, with activists under arrest as authorities sought to avoid embarrassment during anniversary celebrations.
A huge security operation shut down large parts of the normally throbbing city, with thousands of police deployed to keep away demonstrators angry at Beijing's tightening grip on the freedoms of nearly eight million people.
The lockdown reflects Beijing's concern that nothing should be allowed to taint the high-profile visit, ahead of a key Communist Party congress later this year which is expected to cement Xi's position as the most powerful Chinese leader in a generation.
More than 20 activists — including Joshua Wong and young legislator Nathan Law — remained in custody Thursday night after being arrested for causing a "public nuisance" during a Wednesday night protest.
The three-day visit is Xi's first since becoming leader in 2013, and comes three years after huge pro-democracy protests crippled the semi-autonomous city for months as "Umbrella Movement" campaigners camped out on thoroughfares.
Xi's carefully choreographed trip began with his arrival at Chek Lap Kok airport on an Air China plane, where he emerged holding hands with his wife, singer Peng Liyuan, to be welcomed by a marching band and flag-waving children.
He pledged support to Hong Kong and said the city had a place in his heart, adding that he wanted to ensure the continuation of Hong Kong's "one country, two systems" set-up, which is enshrined in the handover deal and gives it rights unseen on the mainland.
Pro-democracy campaigners say the system is being eroded as Beijing interferes in a range of areas, from politics to education and media.
Later in the day, while meeting with unpopular city leader Leung Cheung-ying and senior officials, Xi praised the government for "dealing a blow" to an independence movement that has infuriated Beijing.
Calls for the city to break away from China grew out of the failure of the mass pro-democracy rallies in 2014 to win political reform.
Xi also complimented Leung for his "firm" handling of the city and dealing with what he called "accumulated problems."
Protesters gathered Thursday night outside the city's Court of Final Appeal for a candlelit vigil for cancer-stricken Chinese dissident Liu Xiaobo who was released on medical parole earlier this week, but remains on the mainland.
"Xi Jinping came to Hong Kong. We want to say we don't want any blessing. We don't want your support for Hong Kong," says activist and former lawmaker Lee Cheuk-yan.
"Today we just want to say one thing: Free Liu Xiaobo!"
A reporter had earlier shouted to Xi on the airport tarmac, asking whether he would free Liu. The question was ignored.
Xi and his entourage have taken over two hotels near the convention center on Hong Kong Island's famed waterfront, which will be the scene of many celebratory events over the next 48 hours.
The area has been cordoned off by giant water-filled barricades and police have said they are taking "counter terrorism security measures" to ensure Xi's safety.
Animosity towards Beijing has grown in recent years, particularly among young people.
The mass rallies in 2014 sparked a new wave of "localist" activists, keen to emphasize Hong Kong's own identity.
But some residents were jubilant.
Female dance troupes took to public stages near the convention center, some performing military-inspired routines in camouflage and red berets.
The zones were decorated with cartoon images of the president and his nickname "Xi Dada" — which translates as "Big Daddy Xi" — used as an affectionate term by the mainland Chinese public and in propaganda videos.
"It's a big honor for Hong Kong," says resident Kom Chan who came to the city more than 20 years ago from Fuzhou in southern mainland China, where Xi served part of his career.
"The city has been spoiled. I hope Hong Kong can stop playing politics and focus on the economy," he added.
Xi's visit will culminate in the inauguration of new city leader Carrie Lam, who was appointed by a pro-China committee and is already being cast as a Beijing stooge by critics.
Lam has said she wants to focus on livelihood issues in a city where the wealth gap is at a record high and many cannot afford decent housing, fueling tensions.