HONG KONG — Hong Kong’s judiciary has long been one of its most prized institutions, a legacy of colonial rule in which the judges inherited not just the wigs and gowns of British courts, but also the common law traditions of fairness and independence.

Confidence in the rule of law has helped set Hong Kong apart as one of Asia’s best-run cities and a global financial center on par with New York and London. The court system is seen as the ultimate guarantor of the autonomy from the authoritarian mainland that Beijing promised when Hong Kong rejoined China in 1997 under the formula “one country, two systems.”

But in recent months, a series of politically charged cases has put Hong Kong’s judiciary under some of the greatest scrutiny it has faced in two decades of Chinese rule. Many see a test of whether the courts can protect freedoms even as Beijing exerts more influence over Hong Kong’s compliant local government and increasingly cowed press.

“Because the government lacks the kind of legitimacy that the governments of the West enjoy, people in Hong Kong tend to place more weight on courts,” said Paul Shieh, a barrister and former chairman of the Bar Association.