Chinese President Xi Jinping has warned against “impermissible” challenges to Beijing’s authority over Hong Kong.
Mr Xi was speaking at the swearing-in of the territory’s new leader Carrie Lam, as it marks 20 years since its handover to China from Britain.
He took part in a series of lavish events, including a flag-raising ceremony, amid tight police security.
But clashes took place between pro-democracy and pro-Beijing demonstrators close to the site. Several were held.
The visit was Mr Xi’s first to the city since becoming leader in 2013 and comes three years after mass pro-democracy rallies crippled parts of the territory for months.
He oversaw the swearing in of Ms Lam, the newly-elected chief executive of the territory, along with the rest of her cabinet. She is Hong Kong’s first female leader.
In a speech he said that Hong Kong needed to “improve its systems to uphold national sovereignty, security and development interests”.
“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,” he said.
He added that Hong Kong now enjoyed more freedom than ever before.
But while Hong Kong’s Basic Law guarantees wide-ranging freedoms under the “one country, two systems” formula, Beijing’s refusal to grant universal suffrage has triggered sometimes violent unrest.
In Saturday’s protests, pro-democracy party Demosisto said police had arrested five of its members, and four members from the League of Social Democrats.
Among those said by the group to have been arrested was Joshua Wong, the leader of the so-called umbrella protest movement.
Slammed to the ground – Juliana Liu, BBC News, Hong Kong correspondent
It was meant to be a routine demonstration by pro-democracy protesters.
The leaders of the League of Social Democrats and Demosisto had gathered to make their way to the square in the Wanchai district where the flag-raising ceremony was taking place. They were demanding greater voting rights for Hong Kong, as well the immediate release of the Chinese dissident Liu Xiaobo.
But without warning, scuffles began between the demonstrators and the police. Faces were slammed to the ground. And then pro-Beijing supporters turned up, waving flags and blaring patriotic music. Each side was shouting abuse at the other.
The tussle went on for more than an hour, with it ending only after the leaders of the pro-democracy demonstration were led away by police, who called it an illegal gathering.
In the ceremony the flags of China and Hong Kong were raised alongside one another to mark the 20-year anniversary of the city’s handover of British rule.
Helicopters flew overhead as onlookers cheered at the ceremony in Golden Bauhinia Square, central Hong Kong.
On Friday, an official protest zone near the convention centre where Mr Xi was guest of honour at an anniversary banquet and variety performance was heavily patrolled, as demonstrators gathered chanting “end one-party dictatorship”.
There is growing concern that the Chinese central government is undermining Hong Kong’s more politically liberal traditions, despite its promise to give it a high degree of autonomy.
Democracy campaigners clashed with pro-Beijing supporters near the venue, with police separating the two sides.
Among the pro-democracy activists was Mr Wong, who earlier told demonstrators that the only person responsible for “causing a public nuisance” was “Xi Jinping”.
He and 25 other activists were arrested on Wednesday for “breaking the ‘public nuisance’ law” after climbing into a golden sculpture of a bauhinia flower, Hong Kong’s emblem.
The sculpture, which sits by the city’s harbour front, was a gift from China and an iconic landmark symbolising the handover.
Source: BBC