Despite its unpleasantness, pain has a critically important purpose, designed to protect the body rather than harm it.