HONG KONG — A political candidate in Hong Kong has been barred from running for office, after government officials said Saturday that his support for the territory’s independence from China made it impossible for him to uphold the legal duties of a lawmaker.

The government previously said candidates for the legislative election in September must declare that they recognize Hong Kong as an “inalienable part” of China or face disqualification.

The candidate who was disqualified, Chan Ho-tin of the Hong Kong National Party, signed a pledge to uphold the Basic Law, the mini-constitution that has governed Hong Kong since the former British colony was returned to Chinese control in 1997.

But he refused to answer an election official’s follow-up questions about whether he would continue to push for Hong Kong’s independence from China. In a reply, posted online, he questioned whether the official had the right to ask such questions.