Dr Mike Knapton, associate medical director at the British Heart Foundation, said: "This large-scale study worryingly highlights just how quickly you become at risk of having a heart attack after starting NSAIDs (non-steroidal anti-inflammatory drugs).

"Whether you are being prescribed painkillers like ibuprofen, or buying them over the counter, people must be made aware of the risk and alternative medication should be considered where appropriate."

The research team from Canada, Finland and Germany said there was a "a rapid onset of risk" for heart attack within the first week of use, while risk was highest during the first month of taking the painkillers.

However, using the drugs for longer than one month did not increase risk more compared to shorter use.

Meanwhile the added chances of a heart attack were more pronounced among users on high doses of the painkillers.

Use for between eight and 30 days at a high dose was "particularly harmful" when people were taking more than 1,200mg a day of ibuprofen, 750mg a day of naproxen and more than 25mg a day of rofecoxib.