(CNN) Gelatin produced from donkey hide is a key ingredient of one of China's favorite traditional remedies, known as ejiao, which is used to treat a range of ailments from colds to insomnia.

But as the rising power shifts towards advanced industry and away from traditional agriculture, donkeys are in decline. State statistics show the population has fallen from 11 million to six million over the last 20 years.

China is now increasingly looking to Africa to boost its stocks, and imports donkeys from countries across the continent. But flourishing trade has hit several roadblocks.

Donkeys decimated

Niger recently became the latest African state to ban exports of donkeys, following a surge in sales to China.

Government officials reported that 80,000 animals had been sold in the first 9 months of 2016, compared with 27,000 in 2015, and warned that the donkey population would be "decimated" on current trends.

In August, Burkina Faso took the same step, after 45,000 donkeys were slaughtered in six months from a total population of 1.4 million.

In both cases, the value of donkeys soared and the fledgling industry delivered a valuable stream of foreign currency. But growth came at a cost.

Donkeys transport straw through the district of Niamey, Niger.

Growing pains

Beyond the severe damage to donkey populations, the new industry caused environmental and economic problems.

The spread of abattoirs generated a backlash. In the Burkinabe village of Balole, local farmers reportedly attacked and closed a slaughterhouse in protest at blood and offal leaking into their water supplies.

The donkey boom also attracted farmers from other livestock trades, which suffered as a result, and were also affected by inflation.

"In Niger and Burkina Faso the rising value of donkey hide and meat created inflationary impact in other sectors," says Dr. Emmanuel Igbinoba. "The price of other animals rose because of the donkey, not because there was demand for this animal, which caused imbalance in the economy."

The exporting countries suffered from a lack of regulation, according to Eric Olander, co-founder of the China Africa Project and host of the China in Africa podcast.

"Just as with other livestock, raw materials and other natural resources, the scale of the demand from China is often so large that it can rapidly overwhelm the supply of any single resource," he says. "Governments that trade with China...have an obligation to their people to regulate trade so it does not deplete any single resource to the point where it imposes burdens on their own people."

The traditional remedy ejiao, which uses donkey gelatin, treats a wide range of ailments including colds and insomnia.

Opportunity knocks

China's huge appetite for donkeys does create opportunities that exporters can benefit from with careful planning, says Igbinoba.

"There is steady demand for the gelatin," he says. "If African countries can regulate well, with high standard abattoirs, and train people how to rear these animals, the donkey can be an important source of income."

Burkina has announced plans to regulate donkey sales, but will face competition from continental rivals willing to pick up the slack.

Major economies such as Kenya and South Africa are scaling up their facilities to meet Chinese demand, and a black marke t is also flourishing across the continent.

Chinese demand is expected to increase with a growing consumer class willing to spend on luxury goods such as ejiao.

The challenge for suppliers is to ensure the trade is a blessing rather than a curse.