BEIJING (CNN) -- Bear farming will be banned within 15 years under a new agreement between Chinese authorities and animal-rights activists.

The agreement comes following international pressure to ban the practice used to obtain the bear's bile. Activists say farming bears is unnecessary and barbaric.

Bears are the only mammals to produce significant amounts of the bile acid -- ursodeoxycholic acid (UDCA) -- which has been used in traditional Oriental medicine for some 3,000 years.

In the farms, bears with catheters surgically implanted into their gall bladders are confined in restraining cages so that bile can be extracted. But the surgery to insert the implants is crude and unsanitary and many of the bears die as a result. The animals that survive spend the rest of their lives suffering a confined existence in tiny wire crates, where they cannot even stretch, enduring painful daily extraction of their bile.

It is a lucrative practice for the farmers. Bear bile sells for as much as $10 a teaspoonful. It is used for by Chinese to treat a variety of maladies, such as fever, liver illnesses and sore eyes.

But animal-rights activists say bear bile can be replaced by herbs or synthetically made substances.