Heart disease patients with a positive attitude live longer than those with a negative attitude, and this boost in survival may be due to increased exercise, a new study from Denmark suggests.

In the study, heart disease patients with a positive attitude were 42 percent less likely to die over a five-year period than those with a negative attitude. All patients in the study had coronary artery disease, or a narrowing or hardening of the arteries that supply blood to the heart.

More from LiveScience

7 Foods Your Heart Will Hate

8 Tips for Healthy Aging

7 Common Exercise Errors And How to Fix Them

What's more, patients with a positive attitude were about twice as likely to exercise. In fact, a further analysis revealed that those with a positive attitude lived longer because they exercised.

However, the researchers don't know which came first: Does a positive attitude give heart disease patients the motivation they need to exercise, or does exercise put you in a better mood? There is evidence for both hypotheses, said study researcher Susanne Pedersen, a professor of cardiac psychology at Tilburg University, the Netherlands.

"Irrespectively, [the finding] cements what we already know — namely, that exercise is good for the heart," Pedersen said. [4 Reasons to Exercise Even When It's Cold Out]

Until researchers know which comes first, improving mood as well as doing more exercise may help patients live longer, Pedersen said. Generally, interventions for heart disease patients tend to focus on reducing negative mood and depression, but this is not the same as enhancing positive mood, Pedersen said.

Previous studies have found a link between an optimistic, positive attitude and better outcomes for heart disease patients, but the reason for the link was not known.

The new study analyzed information from about 600 patients with coronary artery disease who were treated at a Denmark hospital. In 2005, patients answered questions to assess their mood, and how often they exercised.

Among the 80 patients who died during the study, 30 patients (10 percent) were assessed as having had a positive attitude, while 50 (16.5 percent) had a more negative attitude.

Besides exercise, there are multiple reasons why a positive attitude might be good for heart health, said Dr. Suzanne Steinbaum, a preventive cardiologist at Lenox Hill Hospital in New York.

A positive outlook may reduce levels of stress hormones and inflammatory markers, Steinbaum said. And people with a positive outlook tend to adopt other healthier behaviors, such as eating better, sleeping better and not smoking.

"I think that people who are positive are more likely to do things to take care of themselves, and to help themselves," Steinbaum said.

The study did not collect information about the duration and intensity of the patients' exercise, which may affect the link between positive attitude and mortality, the researchers said. It is published Sept. 10 in the journal Circulation: Cardiovascular Quality and Outcomes.

Copyright 2013 LiveScience, a TechMediaNetwork company. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.