A top Chinese official has warned Hong Kong against seeking independence during an “inspection visit” of the semiautonomous region.

Zhang Dejiang, the Communist party’s third-highest ranking official and responsible for Hong Kong affairs, spoke at a banquet on Wednesday that was attended by senior city officials and business leaders.

Zhang is on a three-day visit to the former British colony, where discontent is rising over Beijing’s tightening grip. Tension remains high two years after the Chinese government said it would not allow unrestricted elections for the city’s top leader, a decision that sparked pro-democracy street protests that brought parts of the city to a standstill for weeks. Some radical “localist” groups have recently started calling for greater autonomy and even independence for the specially administered Chinese region.

Zhang Dejiang delivers his speech during a banquet in Hong Kong. Photograph: Reuters

“There are a very small number of people rejecting ‘one country’ and resisting the central government. They’re even flying the banner of Hong Kong independence,” Zhang said. “This is not a matter of localism, but it’s separatism under the name of localism.”

Zhang also warned people not to break the law but did not refer to any specific offences. “No one can override the law, and no offenders can evade legal jurisdiction with any excuse,” he said. “Society should severely condemn those actions which challenge the rule of law.”

He said the “one country, two systems” framework, under which Beijing allows Hong Kong a high degree of control over its own affairs as well as civil liberties unseen on the mainland, is in the city’s best interests.

Hong Kong authorities have ratcheted up security for Zhang’s visit, deploying as many as 8,000 police officers, the South China Morning Post newspaper reported, citing an unidentified police source. Water-filled plastic barriers and metal barricades circle the hotel and conference centre where Zhang is spending much of his time. Paving stones have been glued together to prevent protesters from throwing them, construction work has been suspended, and some shops and restaurants have shut temporarily.

Earlier in the day, a group of about 100 protesters who tried to get close to the business conference where Zhang was delivering a speech were kept well away in a designated protest zone.