Health officials have advised patients with heart problems to avoid an over-the-counter painkiller used by millions after research found that it can significantly increase the risk of heart attack or stroke.

The Medicines and Healthcare products Regulatory Agency (MHRA) said that patients with an underlying heart condition, such as heart failure, heart disease or circulatory problems, or patients who have previously suffered heart attacks or strokes, should no longer use diclofenac.

An MHRA spokesman said the advice on the drug has been updated after a European review found an increased risk of heart attack and stroke. Research published in 2011 in the journal PLOS Medicine found that patients using diclofenac were 40% more at risk than those not using it.

In 2010, diclofenac was the most commonly prescribed non-steroidal anti-inflammatory drug (NSAID) in Britain, with 6m prescriptions written. The drug is also available to buy over the counter.

During 2010, almost 17m prescriptions were filled out for NSAIDs, which are used to relieve pain and combat inflammation in conditions including arthritis, back pain, gout, headache, and the aches and fever associated with flu.

Dr Sarah Branch, deputy director of the MHRA's Vigilance and Risk Management of Medicines Division, said: "Whilst this is a known risk and warnings have been included in patient and healthcare information for some time, this advice is now being updated.

"For many patients diclofenac will continue to provide safe and effective pain relief but it is no longer suitable for certain at-risk groups."