The city of Hong Kong on Saturday celebrated the 20th anniversary of its transfer from British authority to China.

Chinese President Xi Jinping swore in Hong Kong's new leader Carrie Lam. On Saturday, she formally became the city's first female chief executive and fourth leader since its transfer from British rule.

"The people of Hong Kong enjoy more extensive democratic rights and freedoms than at any other time in its history," Xi said during the ceremony.

While Xi praised the city as more free than ever before, he warned that any threats to the authority of Beijing "crosses the red line and is absolutely impermissible," perhaps referencing the pro-democracy "Umbrella Movement" protests that lasted for months after China announced that it would have to approve the nomination for the territory's chief executive.

Xi also warned against anyone using the city "to carry out infiltration and sabotage activities against the mainland."

Lam and her cabinet swore to serve China and Hong Kong as well as uphold the semiautonomous city's Basic Law.

In March, Hong Kong's election committee chose Lam, a former government official. However, the committee was criticized for allegedly being stacked with pro-Beijing members.

Read more: Hong Kong's 20 years under Chinese rule - A failed project?

Although Hong Kong's Basic Law - enacted on July 1, 1997 - stipulates the city should work towards universal suffrage, proposals to reform the election process have stalled since 2014, when pro-democracy protests swept across the city.

Pro-Beijing protesters clashed with pro-democracy protesters during a march to the venue where official ceremonies were held

'Returned to the motherland'

On Saturday, pro-democracy protesters clashed with police amid increased security across the city for Xi's visit.

Several groups announced demonstrations slated for later Saturday. A pro-independence group canceled their protest, saying heavy pressure from police had prompted them to do so.

Xi has vowed to stop separatist movements from violating China territorial integrity. Last year, the Chinese president said he "will never allow any person, any group, any political party" to divide the country's territory.

Read more: Sieren's China: Learning from Hong Kong

On Friday, during a ceremony commemorating the transfer of Hong Kong from British to China rule, Xi said issues between Hong Kong and China should not be handled with an "emotional attitude."

"In the 20 years since Hong Kong was returned to the motherland, the success of 'one country, two systems' is recognized by the whole world," Xi said.

"Of course, during the implementation, we've met some new situations, new issues and new challenges. On these issues, they need to be regarded correctly and analyzed rationally … Issues are not scary. The key is to think of ways to solve these issues," he added.

ls/kl (Reuters, AFP, dpa)