Erectile dysfunction (impotence) is sexual dysfunction characterized by the inability to develop or maintain an erection of the penis during sexual performance. A penile erection is the hydraulic effect of blood entering and being retained in sponge-like bodies within the penis. The process is often initiated as a result of sexual arousal, when signals are transmitted from the brain to nerves in the penis. Erectile dysfunction is indicated when an erection is difficult to produce. There are various circulatory causes, including alteration of the voltage-gated potassium channel, as in arsenic poisoning from drinking water.

Causes

In general, erectile dysfunction is quite likely to be psychological rather than physical if the man:
is still waking with morning erections
can still get a good erection by masturbation.

Common psychological causes of erection difficulties include:

nerves – especially about performing
guilt – notably if you're trying to have sex with somebody else's wife
relationship problems – especially if you're no longer keen on your partner
latent gayness – for instance, if you’re a basically gay guy, trying to have sex with a woman
depression
exhaustion.
In a lot of cases, ED turns out to be due to a mixture of psychological and physical causes.

Common physical causes include:
deterioration of the arteries – this is a physical change which is common in older men, including those with high blood pressure
diabetes
smoking
excessive drinking (hence the phrase 'Brewer's droop')
being obese and out-of-condition
side-effects of certain drugs, notably ones for blood pressure and depression
effects of recreational drugs, like cocaine.

Less common physical causes include:
excessive drainage of blood from the veins of the penis (‘venous leak’)
diseases of the nervous system
injury to the spinal cord or brain
major surgery in the abdomen, particularly prostate operations
hormone problems, including excess production of a pituitary hormone called prolactin (this is rare).

Treatment


Treatment depends on the cause.
Exercise, particularly aerobic exercise is an effective treatment for erectile dysfunction.

When pharmacological methods fail, a purpose-designed external vacuum pump can be used to attain erection, with a separate compression ring fitted to the penis to maintain it. These pumps should be distinguished from other penis pumps (supplied without compression rings) which, rather than being used for temporary treatment of impotence, are claimed to increase penis length if used frequently, or vibrate as an aid to masturbation. More drastically, inflatable or rigid penile implants may be fitted surgically. Medications carry risk of priapism.
All these mechanical methods are based on simple principles of hydraulics and mechanics and are quite reliable, but have their disadvantages.

The types of surgery
which are available for ED are as follows.

Curing a venous leak. As we've indicated above, a few men lose their erections because blood leaks out of the penis through a leakage in the veins. Occasionally, this leak only occurs in certain sex positions. Where a leak can be clearly pin-pointed by special X-rays, a urologist may be able to operate in order to improve matters.

Insertion of internal splints. A skilled urologist can insert artificial splints inside the body of the penis. With the simplest type of splint (which is just a firm rod), the man lifts the organ into a vertical position when he wants to have intercourse. There are more sophisticated (and much more expensive) internal splints that you or your partner can inflate when you wish to make love. Some couples report being very pleased with these. But if anything goes wrong with the surgery – for instance, infection or bleeding – you could be in some trouble.