This summer, when Hong Kong’s stock market rout seemed to have no end in sight, the city’s financial chief, Paul Chan, jumped into action, creating a task force to inject confidence into a market that was being pummeled by global investors wary of China.

Hong Kong cut taxes on trading, and Mr. Chan went on a roadshow to Europe and the United States, promising measures to “let investors feel optimistic about the outlook.” Investors were anything but sanguine, however, and the city’s stock exchange is among the world’s worst-performing stock markets this year.

The Hang Seng Index finished Friday, its last trading day in 2023, 14 percent lower than it started the year. Stocks in mainland China also recorded losses this year, with the CSI 300, an index that tracks companies listed in Shanghai and Shenzhen, declining 11 percent.

Hundreds of billions of dollars flowed out this year as money managers and pension funds reduced their holdings in Hong Kong, which has long been a gateway for foreign investors wanting to put money into mainland China. The outflows were largely driven by an economic downturn in China and mounting pressure on American investors to sell their exposure to Chinese companies.

“Many of the companies in the Hang Seng Index are essentially companies that are leveraged to economic growth in China,” said Chetan Seth, an Asia equity strategist at Nomura, a Japanese bank. “China’s weak economy clearly has weighed on the performance of Chinese stocks listed in Hong Kong,” Mr. Seth said.

The losses in Hong Kong and the mainland contrasted sharply to what happened in the United States, where inflation eased and the job market was strong. The S&P 500, which broadly tracks U.S. stocks, was up 25 percent in 2023, underlining the divergent paths of the world’s two largest economies.

Global investors started the year optimistic that China’s economy would bounce back after three years of strict pandemic rules and lockdowns. But when China fully opened its borders in January for the first time since 2020, many households were reluctant to spend. Private businesses floundered, and the economy slowed.

China’s roiling property crisis has intensified the economic slump and spilled over into Hong Kong. After years of overexpansion and borrowing from foreign investors in Hong Kong, nearly every private Chinese real estate developer has collapsed.

Chinese property companies listed in Hong Kong were among the worst-performing stocks. The real estate developer Country Garden, one of the biggest casualties of the property crisis, has lost nearly three-quarters of its value this year as it edges closer to a collapse.

Mr. Chan, the finance secretary, has blamed “misunderstandings caused by Western political prejudices” for the stock market’s poor performance, as geopolitical tensions between Beijing and Washington hit a low point during the year. But 2023 was the fourth consecutive year that the Hang Seng recorded losses. Over that same time, Hong Kong’s role as a financial nerve center for Asia diminished as it was forced to align more closely with Beijing under a far-reaching national security law.

Hong Kong’s loss of autonomy to China has worried some global investors.

A former British colony, Hong Kong was handed back to China in 1997 with a pledge that it would maintain a high degree of self-governance under a policy called “one country, two systems.” For two decades, this allowed Hong Kong to define itself as unique and distinct from the rest of China, while offering financial access to the world’s second largest economy.

But after citywide protests in 2019, Beijing imposed the national security law, which has silenced political debate and stifled civic activity.

More than 100,000 residents have left Hong Kong over the last few years, in part because of the security law and tough pandemic restrictions. Many young Hong Kong professionals who are still there have expressed a desire to leave, making it a challenge to recruit the talent that has helped the city function as a financial center.

Once a major hub for Wall Street banks, Hong Kong had a drought of initial public offerings this year. Companies raised the lowest amount of money since 2001, resulting in layoffs at financial institutions citywide.

Many international companies have stopped hiring for new positions in Hong Kong. With less money coming into the exchange and fewer transactions, dozens of brokerages have also closed.

China’s downturn, geopolitics, elections in major economies including the United States and the actions of central banks are all likely to make 2024 another volatile year for Hong Kong.

Addressing some of these issues in an interview in a recent interview with the South China Morning Post, Mr. Chan said, “2024 will be a year of high uncertainty.”