(CNN) Taking even over-the-counter doses of common painkillers known as NSAIDs -- nonsteroidal anti-inflammatory drugs -- has been linked to an increased risk of heart attack in a new study.

The likelihood of experiencing a heart attack was calculated to increase by an average of 20% to 50%, compared with someone not taking the drugs, regardless of the dosage and amount of time the medications are taken.

The findings are observational and based on an association, however, with the drugs not proved to be a a direct cause of heart attack.

This group of drugs includes ibuprofen, diclofenac, celecoxib and naproxen, which are available over the counter or by prescription for higher doses, to relieve pain or fever resulting from a range of causes, including flu, headaches, back pain and menstrual cramps. Their range of uses also means they are often taken as needed, for short periods of time.

The level of risk increased as early as one week into the use of any drug in this category and at any dose, and the risk associated with taking higher doses was greatest within the first month.

"We found that all common NSAIDs shared a heightened risk of heart attack," said Dr. Michèle Bally, an epidemiologist at the University of Montreal Hospital Research Center, who led the research. "There is a perception that naproxen has the lowest cardiovascular risk (among the NSAIDs), but that's not true."

Researchers' overall finding was that taking any dosage of these drugs for one week, one month or longer was linked to an increased risk of a heart attack. The risk appeared to decline when these painkillers were no longer taken, with a slight decline one to 30 days after use and a greater decline, falling below 11%, between 30 days and one year after use.

Based on the paper, published Tuesday in the BMJ, Bally's team suggests that doctors and patients weigh the potential harms and benefits before relying on the drugs as a treatment option.

"People minimize the risks because drugs are over the counter and they don't read labels," Bally said. "Why not consider all treatment options? ... Every therapeutic decision is a balance of benefits and risk."

Building on previous research

Previous research has showed that this class of painkillers could increase the risk of having a heart attack, known as myocardial infarction. In 2015, the US Food and Drug Administration called on drugmakers to update their warnings labels to identify an increased risk of a heart attack or stroke.

But the specifics in terms of timing, dosage and treatment durations were less clear.

Bally and her team reviewed all available studies in this area from Canadian and European databases, analyzing the findings from 446,763 people, with 61,460 of them having had a heart attack. Their goal was to calculate the risk, determinants and time course of heart attacks associated with the use of NSAIDs under typical circumstances.

The team looked at very short-term use and at any dose, said Bally. "In real life, people use drugs at low doses and use them on and off," she said, adding that this is not reflected in many clinical trials, for example, in which people have often been monitored during prolonged use of these drugs.

When using them for one week, the greatest risk was associated with rofecoxib, followed by diclofenac, ibuprofen and then celecoxib, respectively, though all except celecoxib had similar levels of risk, hovering around 50% increased odds of a heart attack, at any dose.

At higher doses, typically needing a prescription, some drugs had an even greater risk of heart attack between one week and one month of use. For example, naproxen showed a 75% increased likelihood of a heart attack within one month with doses of 1200 milligrams per day or more, and naproxen showed an 83% increased likelihood of a heart attack with doses greater than 750 milligrams per day when taken for one week to one month.

But the level of risk declined, on average, when the drugs were used for longer than one month.

"This is relative to not taking these drugs, your baseline risk," Bally said. "The risk is not 75%. It's an increase (maybe) from a tiny baseline risk that they have."

Millions of these pills are sold every year, Bally said. "Therefore the risk, no matter how small or relative, is important to note from a population viewpoint."

"We already know that these drugs increase your risk of having a heart attack," said Dr. Mike Knapton, associate medical director at the British Heart Foundation, in a statement. "However this large-scale study worryingly highlights just how quickly you become at risk of having a heart attack after starting NSAIDs." Knapton was not involved in the research.

Knapton further added that people must be made aware of the risk and that alternative medication or treatment should be considered where appropriate. For example, physical therapy or yoga could be used to alleviate pain from an injury.

Association, not causation

The researchers stress that the findings are purely observational, as they used readily available data about certain populations. Not all potentially influential factors could be taken into account, they say.

Stephen Evans, professor of pharmacoepidemiology at the London School of Hygiene & Tropical Medicine, commented that a number of lifestyle factors, such as smoking and body mass index, are not available in the data about the study participants. "It leads to uncertainty," he said.

Tobacco use, unhealthy diet, obesity, alcohol abuse and hypertension are just a few of many factors that can cause a heart attack.

"This is the largest study of its kind, but it is still observational data based on prescription or dispensing information, rather than whether people were actually taking their medication," said Dr. Amitava Banerjee, senior clinical lecturer in clinical data science at UCL in the UK. "Although these data reflect real-world use of NSAIDs, it is impossible to control for all the factors which may lead to confounding or bias."

This uncertainty combined with the overall observational nature of the findings means the cause of the increased risk shown in the analysis cannot be explained, nor can the drugs be directly stated as a cause of heart attacks.

Bally thinks a cause could be changes in blood pressure or effects on kidney function, as these areas are poorly studied. But she stresses that all five drugs studied have individual behaviors. "It will be hard to point to one factor," she said.

Relative, not absolute risk

"The paper has good evidence that there is some risk of a heart attack for all NSAIDs and suggests that the risk starts immediately on starting them, but is only expressed in relative terms," said Evans, who was not involved in the research. "There is no clear description of the absolute risk."

The findings are based on the chances of a heart attack occurring in people taking these drugs, compared with those not taking them. If risk was already low in a person, a 20% to 50% increased risk is not that much cause for concern.

"The risks are relatively small, and for most people who are not at high risk of a heart attack, these findings have minimal implications," Evans said.

Join the conversation See the latest news and share your comments with CNN Health on Facebook and Twitter.

It's also possible that people taking these drugs are, on average, already at higher risk than people not taking the drugs, he said, commenting that the study did not account for these factors in their calculations. For example, the reason someone is prescribed an NSAID, such as for severe pain, may also be the reason they have a heart attack soon after. So while the study shows that risk of a heart attack increases as soon as a few days into taking NSAIDs, the links may not be as clear as suggested, Evans said.

"The most likely mechanisms for action of the drugs would be expected to show a low risk at the start and only have an effect on heart attacks after longer usage. That this wasn't the case casts some doubt on the findings of an immediate increase in risk," he said.

"All effective medicines have unwanted effects, and NSAIDs, although easily available, are not without some risks, but this study is no reason to induce anxiety in most users of these drugs," he said.

But while waiting for more clarity on the true level of risk and its cause, experts still advise caution when prescribing or taking these painkillers.

"The increased risk of heart attack with NSAIDs, regardless of which one, means that both health professionals and the public should weigh up the harm and the benefit when prescribing these medications, especially for more than a day or two," Banerjee said.

"Despite the over-the-counter availability of the traditional NSAIDs, this caution is still required. The mechanism of this increased risk of heart attack is not at all clear from existing studies."