If you’re having a heart attack, your life might someday be saved by pond scum.

That’s because these lowly bacteria are capable of producing something a stricken heart desperately needs: oxygen.

In fact, when Stanford scientists injected massive doses of cyanobacteria into the hearts of rats who suffered the equivalent of a “widow-maker” heart attack, oxygen levels ballooned by a factor of 25.

The results, published Wednesday in the journal Science Advances, suggest a truly original approach to reducing the damage done to heart muscle when it is suddenly deprived of oxygen.

When blood flow to the heart is interrupted by a clot or the narrowing of vessels, the effect can be deadly, either now or later. It’s not uncommon for a heart attack victim to survive his or her immediate ordeal, only to succumb to heart failure — the effects of heart muscle weakened by its brush with oxygen deprivation — months or years after the event.

Physicians have long sought to avert that lingering damage by restoring the flow of oxygenated blood to the heart muscle as quickly as possible.

Wielding an arsenal of drugs, stents, grasping devices, saws, scalpels and long, threaded catheters, cardiac surgeons try to isolate, remove or dissolve clots in the arteries feeding the heart before cells start to die off and lasting damage is done.

More recently, stem cells have shown great promise in restoring damaged heart muscle.

But this new approach to rescuing living tissue from so-called ischemic damage proceeds from the observation that oxygen abounds in our atmosphere as a result of photosynthesis — the fuel-making industry of green plants all around us.

If a lack of oxygen is the problem when living tissue is deprived of blood flow, perhaps we should invite into our bodies the forest’s genius for manufacturing the gas our cells depend on to survive.

“Every day we walk around and see trees,” said Dr. Joseph Woo, chair of Stanford School of Medicine’s department of cardiothoracic surgery and the paper’s senior author.

“We wondered, would there be any possibility of taking plants and putting them next to the heart and getting them to work together?”

Several years ago, researchers in Woo’s Stanford lab started by grinding spinach, and then kale, with mortar and pestle. When they introduced the green slurry to living tissue in Petri dishes and set them in the sun, nothing happened.

But when they tried a more primitive practitioner of photosynthesis — pond scum — the oxygenation effect was clear to see.

The scientists used cyanobacteria, the blue-green algae that often blooms on the surface of still waters, to supply life-giving oxygen to the stricken hearts of rats. After clamping off the largest of three arteries feeding blood to the heart — the left anterior descending coronary artery — the researchers injected those hearts with tens of millions of the single-celled organisms.

For two full hours — one hour while the clamp remained in place and a second hour after it was removed — the animals’ incisions remained open.

During that time, the hearts of the treated rats were exposed to strong light, which jump-started the photosynthetic process.

Just as they would on the surface of a pond, the cyanobacteria used the pigment chlorophyll to combine water, carbon dioxide and light to produce glucose. The incidental byproduct of that process — oxygen — kept cells deprived of oxygenated blood from dying off in droves.

A day later, the damage to the hearts of treated rats was less than half as severe as that seen in rats that got an inactive treatment, according to the study.

And four weeks after the ischemic crisis, the hearts of rats that got the photosynthesis treatment performed dramatically better than the hearts of rats that did not.

In humans, an improvement in heart function of the magnitude shown in treated rats “would have profound clinical implications,” the Stanford team wrote.

If humans were to reap benefits as great as those seen in the lab rats, they added, such a treatment probably would spell “the difference between a healthy patient and one suffering from heart failure.”