Erection problems (impotence) are very common, particularly in men over 40. It's usually nothing to worry about, but you should see a GP if it keeps happening. It could be the sign of a more serious problem.
Most men occasionally fail to get or keep an erection.
This is usually caused by stress, tiredness, anxiety or drinking too much alcohol, and it's nothing to worry about.
If it happens more often, it may be caused by physical health or emotional problems.
It could be a sign of an underlying health condition such as diabetes.
Sexual health clinics treat problems with sexual health. They can provide the same treatment you would get at your GP surgery.
Many sexual health clinics offer a walk-in service, where you do not need an appointment.
They'll often get test results quicker than GP practices.
The doctor or nurse will ask about your lifestyle and relationships, and any problems you might be having.
They'll carry out basic health checks, such as taking your blood pressure.
They'll also examine your genitals to rule out any obvious physical cause.
If you have symptoms like needing to pee more often, you may also need to have an examination of your prostate.
Treatments for erectile dysfunction are usually effective and the problem often goes away.
There are also specific treatments for some of the causes of erectile dysfunction.
Medicine such as sildenafil (sold as Viagra) is also often used by doctors to treat erectile dysfunction. It's also available from pharmacies.
Because of changes in regulations, you no longer need a prescription to get sildenafil.
But you'll have to have a consultation with the pharmacist to make sure it's safe for you to take it.
There are other similar medicines called tadalafil (Cialis), vardenafil (Levitra) and avanafil (Spedra) that work in a similar way.
You'll still need a prescription to get these medicines.
You can buy sildenafil (Viagra) over the internet. Be very careful if you do this as many websites sell fake medicines.
Online medicines are not always regulated and the ingredients in them can vary from one pack to another. They can cause unpleasant side effects, or may not be suitable for you.
It's best to see a doctor before buying medicines online. They know your medical history and can discuss whether you might benefit from treatment.
If you choose to buy sildenafil (Viagra) on the internet, make sure:
Healthy lifestyle changes can sometimes help erectile dysfunction.
lose weight if you're overweight
eat a healthy diet
try to reduce stress and anxiety
do not cycle for a while (if you cycle for more than 3 hours a week)
do not drink more than 14 units of alcohol a week
The Sexual Advice Association has factsheets on medicines and other treatments for erectile dysfunction.
Vacuum pumps encourage blood to flow to the penis, causing an erection.
They work for most men and can be used if medicine is not suitable or does not work.
They're not always available on the NHS. Speak to a doctor about where to get a vacuum pump.
It's more likely to be an emotional problem if you only have erection problems some of the time. For example, you get an erection when waking up in the morning, but not during sexual activity.
Anxiety and depression can be treated with counselling and cognitive behavioural therapy (CBT).
A GP might recommend sex therapy, either on its own or in combination with other psychotherapy.
There's usually a long wait for these services on the NHS.
You can also pay to see someone privately.
Counsellors and psychotherapists should be a member of the:
Sex therapists should be a member of the:
Relate also offers sex therapy for a fee.
Advice and support is also available from the Sexual Advice Association.