Absolutely. Nerves must be working normally for a man to get and keep an erection. Nerves can be damaged by diabetes, multiple sclerosis, prostate surgery, or damage to the spinal cord.  However, it depends on the region where the nerves are damaged.  Spinal cord injuries can lead to difficulties with erections. However, erections can be preserved with contact or simulation in many circumstances depending on the level of spinal cord injury. Injury to the peripheral nerves, or nerves that travel between the spinal cord and the penis, can result in erectile dysfunction. Common examples of this would be damage to the nerves associated with taking a prostate out for prostate cancer or sometimes after colorectal surgery for colon cancer.