Taiwan citizens should avoid unnecessary transits through or visits to Hong Kong, Macau or mainland China after the passing of a new national security law for Hong Kong, a senior Taiwan government official said on Thursday.

Taiwan's de facto consulate in Hong Kong will continue to operate, Chiu Chui-Cheng, deputy head of Taiwan's Mainland Affairs Council, told reporters in Taipei, describing the new law as "the most outrageous in history".

The law, which took effect on Wednesday, will target crimes of secession, subversion, terrorism and collusion with foreign forces with up to life in prison, signalling a more authoritarian era for the Asian financial hub.