People with the heart rhythm disorder atrial fibrillation may have a heightened risk of developing dementia -- and the quality of their drug treatment may play a role, a new study hints.

Specifically, researchers found, patients on the clot-preventing drug warfarin showed a higher dementia risk if their blood levels of the medication were frequently too high or too low.

And that was true not only for people with atrial fibrillation, but also for those using warfarin for other reasons.

Get Breaking News Delivered to Your Inbox

Dr. Jared Bunch, the lead researcher on the study, said the findings uncover two potential concerns: People with atrial fibrillation may face an increased risk of dementia, independent of warfarin use, but warfarin might also contribute to dementia if the doses are not optimal.

"If people's levels of warfarin were erratic, their dementia risk was higher, whether they had AF or not," said Bunch, who was scheduled to present his findings Thursday at the Heart Rhythm Society's annual meeting, in San Francisco.

The results do not prove that either atrial fibrillation or warfarin are to blame, according to Bunch, a cardiologist at Intermountain Medical Center, in Murray, Utah.

But, he said, there is reason to believe that both could contribute to dementia -- in part because of effects on blood flow to the brain.

Atrial fibrillation is a common arrhythmia, affecting about 3 million U.S. adults, according to the Heart Rhythm Society. In it, the upper chambers of the heart quiver instead of contracting efficiently. The condition is not immediately life-threatening, but it can cause blood clots to form in the heart. If a clot breaks free and lodges in an artery supplying the brain, that can trigger a stroke.

Because of that, people with atrial fibrillation often take medications that cut the risk of blood clots. Those include aspirin or anticoagulants such as warfarin (Coumadin).

Warfarin is a tricky drug to take, Bunch explained: People need regular blood tests to make sure their warfarin levels are in the "therapeutic range" -- high enough to prevent clots, but low enough to avoid internal bleeding. The doses typically have to be changed over time.

According to Bunch, it's possible that patients with erratic warfarin levels are more prone to "small clots" or "small bleeds" that could affect the brain.

The findings are based on records from over 10,000 patients who were on warfarin for atrial fibrillation or to prevent blood clots from other causes.

Over six to eight years, almost 6 percent of the atrial fib patients developed dementia, including Alzheimer's disease -- versus less than 2 percent of other warfarin patients.

People with atrial fib were generally older and in poorer health. But even after Bunch's team accounted for that, the atrial fib patients had more than double the risk of dementia than that other patients.

The quality of warfarin treatment also seemed to matter, whether patients had atrial fibrillation or not.

Compared with patients whose warfarin was in therapeutic range more than 75 percent of the time, those who were usually out of range had 2.5 to four times the odds of developing dementia.

However, there are many reasons a patient could be out of therapeutic range, said Dr. Gordon Tomaselli, chief of cardiology at Johns Hopkins University in Baltimore, and a past president of the American Heart Association.

So it's hard to pin the blame on warfarin management, according to Tomaselli, who was not involved in the study.

Still, he said it is plausible that both atrial fibrillation and erratic warfarin levels contribute to dementia.

A study that compared warfarin patients to those on newer anticoagulant drugs could help sort out the medication's role, Tomaselli said.

For now, Bunch had some advice for patients. "If you're doing well on warfarin, there's no reason to worry," he said.

In other cases, he added, closer monitoring and better management might help patients keep their warfarin levels in range.

"But if you're someone whose warfarin doses have to be changed a lot," Bunch said, "you could ask your doctor about alternatives."

The newer anticoagulants dabigatran (Pradaxa), rivaroxaban (Xarelto) and apixaban (Eliquis) -- do not have the same "swings" that warfarin does, he noted. (The study received no funding, and none of the researchers reported ties to the companies that make the newer anticoagulants.)

According to Tomaselli, warfarin patients can take their own steps, too.

Certain foods and medications interfere with the drug, for example. So patients should be careful about major diet changes, and always talk to their doctor before taking any new medication, Tomaselli said.

He also emphasized the importance of lifestyle -- in protecting the heart and possibly lowering dementia risk.

"You can't stress enough the importance of a good diet, being physically active, and getting high blood pressure and other risk factors under control," Tomaselli said. "What's good for the heart is good for the brain."