Any attempt to challenge China's sovereignty, security and government authority 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, moments after presiding over the inauguration of Hong Kong's new leader, Carrie Lam.
Hong Kong is an economy specializing in professional services, and there is great potential to develop overseas markets.
Many Hong Kongers sympathise with his plight and fear the same fate - of having their freedom of speech curtailed - if they do not push back against what they see as Beijing's tightening grip on the city.
In his address at an inaugural ceremony of the fifth-term government of the Hong Kong Special Administrative Region (HKSAR), Xi said that Hong Kong can not afford to be torn apart by reckless moves or internal rift amid the intense global competition. "China, Get Out of Hong Kong!" and "Independence for Hong Kong!" jostling with portraits of Nobel peace laureate Liu, was marred by scuffles with pro-Beijing groups and allegations of police violence.
"On the part of the central government, we are ready to talk to anyone who loves the country, loves Hong Kong and genuinely supports the principle of "one country, two systems" and the Basic Law of the HKSAR, no matter what political views or position he or she may hold", he said. "At the same time, there was a strong warning to the localists and the pro-independence people".
Beijing-backed civil servant Lam was chosen to be Hong Kong's next leader in March by a 1,200-person "election committee" stacked with pro-China and pro-establishment loyalists.
Xi has spoken on the 20 anniversary since Britain gave its former colony back to China.
"It is the freedoms Hong Kong enjoys that make it a civilised city".
Activists scoffed at Xi's remarks.
Those same protesters have accused President Xi of deliberately "humiliating" Britain by tearing up the agreement they signed on Hong Kong rights.
"We are calling on them to. pay attention to the voices of Hong Kong people when formulating their policies, not just to focus on the "one country" part", Au said. During the protest, several pro-democracy activists were roughed up by police and some were even detained and bundled into police vans.
China repeats call for Indian troop pullout from Sikkim
Indian media said China had stopped pilgrims crossing into Tibet to visit a mountain revered as the home of the Hindu god Shiva. India has hit out after Bhutan slammed China earlier, further causing more embarrassment to Beijing.
Xi left Hong Kong in the early afternoon Saturday before the kick-off of an annual July 1 pro-democracy march, which saw streets packed with marchers despite stifling heat and rain.
In a speech that ran far shorter than Xi's 32-minute address, Lam reviewed the dynamic financial center's achievements and challenges, pledged to support central government initiatives and declared that "the future is bright".
There was other symbolism hinting at the balance of power. The official transcript of Xi's speech was printed in the mainland's simplified characters instead of Hong Kong's traditional complex characters.
The CBC's Elaine Chau, age 6, and her brother Edmond, in the front yard of their Montreal house in 1992, the year the family moved to Canada from Hong Kong.
Participants in the pro-democracy march largely dismissed Lam as a loyal bureaucrat, but said the change in leadership introduced a new measure of uncertainty. "Things are much more tense".
Still, some say such faith may be misplaced and point out that the British did nothing to promote democracy until the dying days of more than 150 years of colonial rule. More than 37,500 BN (O) passports were issued previous year, a 44 percent jump on 2015 and the highest number for more than a decade, government data shows. The pro-democracy movement lost considerable momentum after Beijing turned a cold shoulder to the 2014 protests.
In the midst of this unsettling atmosphere and unprecedented security measures, Chinese President Xi Jinping landed on Thursday in a city decorated with the flag for his visit, the first since he took office in 2013.
"Long live China", they shouted in unison.
University student Sean Law said Liu's fate showed what the party was capable of in suppressing its foes. China has promised Hong Kong's capitalist system will remain unchanged for "at least" 50 years, but it has not clarified what happens after that.
"But the Hong Kong Chinese actually transformed them", he said.