The legislation targets secession, subversion and terrorism with punishments of up to life in prison. Opponents say it erodes the territory's freedoms as a semi-autonomous region of China. Beijing rejects this. Hong Kong's sovereignty was handed back to China by Britain in 1997 and certain rights were supposed to be guaranteed for at least 50 years under the "one country, two systems" agreement.