A pharmaceutical composition for oral administration contains naloxone-, N-methylnaloxone- and/or N-methylnaltrexone-containing particles which release the active substance depending on the ambient pH. This ensures the liberation of the active substance over the whole gastrointestinal tract. The side effects caused by the use of analgesic opioids, such as constipation, are thus eliminated without reducing the analgesic effect.