HONG KONG — The Chinese government’s top lawyer in Hong Kong said on Tuesday that British colonial legislation could be used to prosecute those advocating that the territory secede from China, but he also said that mainland Chinese security agencies have no authority to detain suspects in Hong Kong.

Only a handful of young democracy activists in Hong Kong have begun calling for the semiautonomous Chinese territory to declare independence and separate itself politically from the mainland. Their position represents the unexpected emergence of a splinter group in a Hong Kong democracy movement that until very recently had positioned itself as seeking a democratic but unified China.

Britain ruled Hong Kong as a colony for 156 years, until 1997, and many colonial statutes remain on the books, including legislation defining severe criminal penalties for acts such as treason and sedition. Wang Zhenmin, the director general of the law department at Beijing’s powerful Central Liaison Office in Hong Kong, said that these laws remained in force and could be used against independence advocates.

“This is still the law in Hong Kong, and this law was made by the British government a long time ago and been applied in 1946 and the 1950s, 1960s,” Mr. Wang said. The colonial authorities used the legislation in 1946 against residents accused of having collaborated with the Japanese occupation during World War II. The authorities also used the laws against pro-Chinese protesters, including admirers of Mao’s Cultural Revolution, into the late 1960s.