Thousands of police have been deployed in Hong Kong as the territory marks 20 years since its handover to China from Britain with a series of lavish events.
China’s President Xi Jinping will join celebrations on Saturday, including a flag-raising ceremony and a fireworks display over Victoria Harbour.
Pro-democracy and pro-Beijing demonstrators are expected to march through the streets over the weekend.
A huge security operation is in place with large parts of the city shut down.
Mr Xi will oversee the swearing in of the newly-elected chief executive of the territory, Carrie Lam, along with the rest of her cabinet on Saturday.
He is expected to depart Hong Kong immediately after the inauguration.
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”.
Democracy campaigners clashed with pro-Beijing supporters near the venue, with police separating the two sides.
Among the pro-democracy activists was leader of the so-called umbrella protesters, Joshua Wong, who told demonstrators that the only person responsible for “causing a public nuisance” was “Xi Jinping”.
Mr Wong was among 26 activists 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.
The demonstrators, who were demanding greater political freedoms, also called for the release of terminally ill Chinese dissident Liu Xiaobo.
Mr Wong was released on Friday morning, the political party Demosisto, founded by him and legislator Nathan Law, said in a tweet.
Police said in a statement the activists had been released on bail and must report back to police in September. They have not been charged.
Their protest was the second one this week at the monument – activists had earlier draped a large black flag over the sculpture and were stopped by police.
Read more about Hong Kong since the handover:
President Xi earlier on Friday inspected troops at a local garrison as part of what was described as the largest military parade in the city since its handover to China in 1997, Reuters news agency reports.
Several demonstrations, including the annual 1 July pro-democracy march, have been planned for this weekend.
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 under the “one country, two systems” principle.
The pro-Beijing camp also has protests planned.
Mr Xi gave a short speech on Thursday after his arrival where he pledged Beijing’s support for Hong Kong, and later met with the city’s outgoing leader Leung Chun-ying and other officials.