Insights about the causes and treatments for self-harm can be derived from studying when it happens to animals.
Self harm takes many forms: cutting with razor blades, biting, picking, burning with matches, scratching or otherwise intentionally damaging one's skin.
One of the things that makes self-harm so puzzling is why anyone would choose to physically damage him or herself. Unfortunately, self-harm can easily be dismissed as "senseless" or "irrational" behavior. And certainly it does seem that way at first glance.
However, research on animals that display this behavior suggests that self harm does serve a purpose - a completely rational one.
In primatology self harm is called self-injurious behavior (SIB) and is associated with anxiety.
According to research by Bayne et al. (1995), there is no consistent evidence for the influence of rearing history on the development of self-harm among primates. What that means is that there's no evidence that the way one grows up or is parented (yes there are parallels to monkey and human parenting and psychological development) affects whether an individual turns to self harm to cope with anxiety.
The single most common denominator among animals who self harm is isolation — social isolation. Primates bite themselves, parrots pull out their feathers and dogs and cats lick themselves. Such self-injurious behavior tends to occur in emotionally disturbing situations, particular those over which the individual has little or no control (like being locked up alone).
Birds, monkeys, people and pets are all very social creatures. Touch plays a big role in the ives of all of these species and when left along that physical contact disappears and anxiety increases. Preening and self-grooming is one way animals and people cope with anxiety. Self touch is soothing but a poor substitute for contact with others.
Research on captive primates and birds has identified that self-injurious behavior is a coping strategy to reduce arousal. Biting, licking, and feather plucking lower heart rate, one marker of relaxation.
Presumably the same sort of thing happens on a physiological level for people who injure themselves. People report feeling more calm during the act and for a little while after.
Self-injurious behavior is notoriously difficult to treat. It's compulsive behavior that defies behavioral interventions largely because a psychologist or therapist can't be present 100% of the time to remind people to replace their harmful habit with a helpful one. That's one reason why drug therapies are so popular. They are effective, with beta blockers being the most effective because they block the mood enhancing endorphins that are released during injury. Those who self harm are addicted to it behaviorally and physiologically.
Given that social isolation, stress and anxiety are the triggers and main reason for self injury, reducing stress and increasing time spent with others would be the most effective. Massage solves both and has demonstrated effectiveness for a wide range of conditions.