Hong Kong's legislature has passed a bill allowing China to carry out customs inspections at a railway station within the semi-autonomous territory.

The development has further alarmed those already concerned about Beijing's tightening grip.

Independent politicians believe the bill governing the Hong Kong terminus of the rail link from the Chinese city of Guangzhou contravenes the Basic Law, the city's mini-constitution adopted after the former British colony was handed over to China in 1997.

The bill allows passengers to clear Chinese border checks inside Hong Kong at the end of the 16-mile high-speed rail line, which will open in September 2018.

This permits Chinese police to enforce mainland Chinese laws within the terminus, the first time such rights have been granted within Hong Kong's territory.

The move comes as Beijing is seen as stepping up pressure on the territory's legal system and civil liberties that are supposed to be preserved until 2047, apart from legal matters related to defence, foreign affairs and national security.

Hong Kong residents enjoy rights such as freedom of speech and assembly that are routinely violated on the mainland.

Hundreds of protesters gathered outside the legislature's offices to watch a live broadcast of the debate and the vote that followed.

Tanya Chan, a member of Hong Kong's legislature, was among those opposed to the move.

"Obviously this co-location arrangement violates the Basic Law, as well as very common legal practices in Hong Kong," Ms Chan said.

Hong Kong activists preserve the past Show all 22 1 /22 Hong Kong activists preserve the past Hong Kong activists preserve the past HK URBEX members, inspect the interior of an abandoned British army barracks in Hong Kong Reuters Hong Kong activists preserve the past HK URBEX members are seen through a hole in the fence at an abandoned British army barracks in Hong Kong, China, June 1, 2017 Reuters Hong Kong activists preserve the past An abandoned British army barracks is seen through thick fog in Hong Kong, China, June 1, 2017 Reuters Hong Kong activists preserve the past A HK URBEX member, stands at an abandoned British army barracks in Hong Kong, China, June 1, 2017 Reuters Hong Kong activists preserve the past A HK URBEX member looks through a window at an abandoned British army barracks in Hong Kong, China, June 1, 2017 Reuters Hong Kong activists preserve the past A HK URBEX member walks through an abandoned British army barracks in Hong Kong, China, June 1, 2017 Reuters Hong Kong activists preserve the past A HK URBEX member looks around an abandoned residential building in Hong Kong, China, June 7, 2017 Reuters Hong Kong activists preserve the past HK URBEX members walk towards an abandoned British army barracks in Hong Kong, China, June 1, 2017 Reuters Hong Kong activists preserve the past A HK URBEX member climbs a ladder at an abandoned British army barracks in Hong Kong, China, June 1, 2017 Reuters Hong Kong activists preserve the past A HK URBEX member inspects the interior of an abandoned British army barracks in Hong Kong, China, June 1, 2017 Reuters Hong Kong activists preserve the past A HK URBEX member, looks at a newspaper from 1982, inside an abandoned residential building in Hong Kong, China, June 7, 2017 Reuters Hong Kong activists preserve the past A tag is seen inside an abandoned British army barracks in Hong Kong, China, June 1, 2017 Reuters Hong Kong activists preserve the past An external view of an abandoned mansion called Yu Yuen, built the 1920's colonial era, is seen in Hong Kong, China, June 7, 2017 Reuters Hong Kong activists preserve the past HK URBEX members look around an abandoned residential building in Hong Kong, China, June 7, 2017 Reuters Hong Kong activists preserve the past A soft toy is seen inside an abandoned residential building in Hong Kong, China, June 7, 2017 Reuters Hong Kong activists preserve the past An interior view of an abandoned mansion called Yu Yuen, built during the colonial era of the 1920's, in Hong Kong, China, June 7, 2017 Reuters Hong Kong activists preserve the past An interior view of an abandoned mansion called Yu Yuen, built during the colonial era in the 1920's, is seen in Hong Kong, China, June 7, 2017 Reuters Hong Kong activists preserve the past People walk past the abandoned historic Central Market, which was built in the 1930's during the colonial era, in Hong Kong, China, June 10, 2017 Reuters Hong Kong activists preserve the past HK URBEX members inspect an abandoned residential building in Hong Kong, China, June 7, 2017 Reuters Hong Kong activists preserve the past An external view of the now closed Wing Woo Grocery Shop on Wellington Street, which was built during the colonial era in the 1870's, in Hong Kong, China, June 10, 2017 Reuters Hong Kong activists preserve the past Colonial era buildings (front to back), St John's Cathedral, former Central Government Offices and Government House are seen in Hong Kong, China, June 3, 2017 Reuters Hong Kong activists preserve the past A man stands outside the abandoned historic Central Market, which was built in the 1930's during the colonial era in Hong Kong, China, June 10, 2017 Reuters

The chairman of the Hong Kong Bar Association, Philip Dykes, said the decision set a worrying precedent because people entering the zone could be found in violation of mainland Chinese laws they were not aware of and subsequently incarcerated in detention centres.

"And the concern is, in the future, if this can be done for a railway station, it might also be done for some other reasons, some other purposes," Mr Dykes said.