The Chinese embassy in the Central African Republic had a stark warning for its compatriots in the landlocked nation: Do not leave the capital city of Bangui. Kidnappings of foreigners were on the rise, and any Chinese person outside of Bangui was to leave those areas immediately.

Less than a week later, on March 19, a group of gunmen stormed a remote gold mine far away from Bangui and killed nine Chinese workers.

The Central African government has said that it investigated the massacre and concluded that a leading rebel group had orchestrated it. The rebels have denied the allegation and blamed a third party that operates in the country — Russia’s Wagner mercenary group, which has in turn accused the rebels. None of the sides has presented evidence for its claims.

The investigation has left a trail of unanswered questions about the motives and methods of the attackers. More than a dozen Central African soldiers were supposed to be protecting the site, according to a diplomat briefed on the investigation, but on the day of the attack, only four of them were there and all survived.

The victims have not been identified, and their bodies were cremated shortly after the attack. One local mayor said the workers were shot at close range. A photo shared by local and Western officials based in the country showed how the assailants left the bodies face down in a row in the rust-colored mud, as if to send a message.

The murkiness around the killings underscored the growing security challenge facing the Chinese government as Chinese companies have rapidly expanded their activities around the world, often stepping into the middle of conflict zones with unstable governments and armed groups vying for territory.

Chinese workers have faced rising threats in countries like Nigeria, the Democratic Republic of Congo and Pakistan, including a suicide bombing last year that targeted a Chinese cultural center in Karachi and killed three Chinese teachers. In 2020, three Chinese nationals were killed after a Chinese-owned warehouse in Zambia was set on fire.

The attacks have exposed the widening disconnect between China’s economic ambitions and its security apparatus abroad, which relies on a patchwork of local military, mercenaries and private firms to guard Chinese workers, analysts say. China’s military has a minimal presence overseas and a limited ability to project force far beyond its borders, according to John Van Oudenaren, an analyst focused on Chinese foreign policy at the Jamestown Foundation, a think tank.

But China’s leader, Xi Jinping, has aggressively trumpeted a more nationalist image of China, raising the pressure at home on his government to show that China is proactively protecting its citizens overseas. In late April, as part of the evacuation of Chinese nationals out of Sudan, which has been rocked by a war between two rival generals, the Chinese government sent a military vessel that displayed the sign: “Chairman Xi has sent this naval ship to bring everyone home.”

“China is on thin ice in the sense that they’re entering some of the most poorly governed places in the world and supercharging conflicts,” said Ammar Malik, a senior research scientist at William & Mary who tracks Chinese development finance. “And every time an attack happens, it angers the Chinese public and forces China to reconsider this light-touch, hands-off approach.”

After the killings in the Central African Republic, people on Weibo, China’s version of Twitter, commented sarcastically that the attack did not align with the portrayal of China in the “Wolf Warrior” movies, a pair of nationalistic Chinese action films that promoted the notion that China would always protect its citizens from danger in foreign lands.

But most online comments about the attack were heavily censored, with Weibo playing down hashtags about the deaths. Instead, the site highlighted a sharp public rebuke by Mr. Xi, who called for the attackers to be severely punished.

The accusations around Wagner’s potential involvement are particularly sensitive for China, pointing to the complications Mr. Xi faces as he strengthens ties with Russia, even amid the war in Ukraine, with the goal of counterbalancing the United States and its Western allies. The killings occurred one day before Mr. Xi landed in Moscow to meet with his Russian counterpart, Vladimir V. Putin.

Some influential Chinese, like Hu Xijin, the former editor of the Global Times, a Communist Party newspaper, have said those who blamed Wagner for the attack were trying to undermine relations between China and Russia.

Wagner, a Kremlin-backed private network of firms involved in security, political influence and the exploitation of natural resources, has been a dominant presence in the Central African Republic since 2018. It provides personal protection and political support for President Faustin-Archange Touadéra, in exchange for access to diamonds, gold and timber.

In many parts of the country, Wagner has pushed out rebel groups from resource-rich areas, prompting them to turn more to kidnappings for ransom.

In early March, miners started to work near the village of Chimbolo, several hours northeast of the capital. The Gold Coast Group, a Chinese company, was opening a new gold mine there. The attack came soon after.

Researchers and local officials say the area is controlled by Wagner and the Central African army. But the government blamed the Coalition of Patriots for Change, an alliance of rebel groups. In response, Aboubakar Siddick Ali, a spokesman for the group, said in an interview that the rebels did not operate in the area to avoid being “cornered by Wagner.”

Wagner has become more dependent on its mining operations in Africa, a source of hard cash that helps businessmen close to the Kremlin circumvent the Western sanctions imposed after its full-scale invasion of Ukraine, said Alessandro Arduino, an expert on Chinese security at King’s College London.

“Wagner and China have the same exploitative interest in Africa, but Wagner thrives in chaos, while China needs stability,” Mr. Arduino said.

Gold Coast, which was not reachable for comment, was one of many small Chinese mining companies that have sought in recent years to mine gold from the Central African Republic. Those firms have diverted waterways to mine riverbeds, researchers say, damaging the environment and angering local populations. Several of them have also been accused of human rights abuses.

“The presence of foreign companies creates tensions with locals, as one can expect,” said Olivier Mbombo Mossito, who previously worked as a public prosecutor in Bambari, the closest city to the site of the killing. “The acquisition of this mining site by a Chinese company may have caused some anger, but from whom?”

Arnaud Djoubaye Abazène, the Central African Republic’s justice minister, told reporters last month that the rebels were “unquestionably” behind the killing. But he did not release any evidence or take questions from reporters. He thanked “our Russian allies” for arresting and killing some of the suspected attackers, who have not been named.

Yevgeny Prigozhin, the head of Wagner, said in a written response to questions that “bandits killed the Chinese.”

“The bandits were found,” Mr. Prigozhin wrote. “There is nothing to discuss here.”

But researchers and Western diplomats say the killings of the miners did not fit the profile of how rebel groups have targeted Chinese nationals in the past. The groups have typically kidnapped Chinese workers to extract ransom from their employers, with such execution-style assassinations being highly unusual.

Two Chinese officials dispatched from Beijing attended the justice minister’s news conference. They said that they had not yet been able to access the scene of the crime.

The mine has been closed since March 19. China repatriated about 80 citizens shortly after the killing.

Nicole Hong reported from Seoul and Elian Peltier from Dakar, Senegal. Abdi Latif Dahir contributed reporting from Nairobi, Kenya.