A composition comprising the tannate of an opioid. Suitable opioids include alfentanil, buprenorphine, butorphanol, carfentanil, cocaine, codeine, dezocine, diacetylmorphine, dihydrocodeine, dihydromorphine, diphenoxylate, diprenorphine, etorphine, fentanyl, heroin, hydrocodone, hydromorphone, beta-hydroxy-3-methylfentanyl, levo-alpha-acetylmethadol, levorphanol, lofentanil, meperidine, methadone, morphine, nalbuphine, nalmefene, o-methylnaltrexone, naloxone, naltrexone, oxycodone, oxymorphone, pentazocine, pethidine, propoxyphene, remifentanil, sufentanil, tilidine and tramadol. The opioid tannate may be readily prepared by reacting an opioid free base with tannic acid, either neat or in the presence of up to about 30 wt. % water, at a temperature of about 60 to about 150° C. and thereafter recovering the resultant opioid tannate. The opioid tannate may also be prepared by an alternative process that involves reacting the opioid free base with water at a temperature such that not more than about 10 wt. % of the opioid tannate will be decomposed and thereafter removing the water by freeze-drying.