SAN FRANCISCO — Talks between the small African cooperative and the pharmaceutical giant got off to a promising start. But within weeks, the negotiations had grown so tense that the company’s counsel doubted it could strike a deal to land the natural resources it needed.

After a few concessions on both sides, the parties agreed to launch three joint ventures to mine the extract that would be a key ingredient for the company’s new drug, manufacture a fertilizer from the byproducts and distribute other products in Africa.