MINGLIANG, China — To the people of Shanglin County, gold is a curse.

For nearly a decade, thousands of peasants from this rural speck in southern China’s Guangxi Autonomous Region borrowed heavily before boarding flights for Ghana, Africa’s second-largest gold producer, with glinting ambitions and no backup plan.

The Chinese found their gold, though trouble soon found them, in the form of crooked police officers and armed bandits who prowled the mining camps. Then, this month, the Ghanaian authorities declared the mines illegal and arrested more than 200 Chinese miners, accusing them of polluting the land and abusing local workers. Countless others fled as local residents armed with guns and machetes attacked the camps, robbing miners of their possessions and killing some who fought back.

After the crackdown, images of violent deaths and vandalized mining camps blazed across Chinese social media, fueling national anger and soul searching. But here in Shanglin, a mountainous county of 470,000 in one of China’s poorest regions, it is despair over financial ruin that is most pronounced.

“My son might be killed in Ghana, but if he comes back he’s dead anyway,” said Shen Aiquan, 65, whose family borrowed 3 million renminbi, or $489,000, to build a mining operation, though from whom exactly she did not know. All she could do was wait for her son, and the debt collectors who would surely follow.