When my husband first experienced pressure in his chest, his general practitioner thought it was likely heartburn. My husband, a thin vegan who practiced a strenuous form of yoga daily, was not the typical profile of someone with a heart problem. But then again, many with genetic heart problems aren’t.

When the intermittent pain continued, regardless of what Mason ate, we contacted a friend who was closely connected with a renowned cardiologist. My husband was given an appointment the next day.

Mason followed up with a CT scan, which showed that he did indeed have significant blockages in his heart vessels. The cardiologist was set to perform an in-hospital angiogram right away, which would give him a more precise picture of the heart and vessels. We were hoping for the least invasive procedure: the placement of a stent or two to widen the arteries. Nonetheless, whatever the test showed and whatever procedure he needed, my husband was just eager for a “good outcome”—to make it through the procedure intact and regain his health.

A “good outcome” was precisely what he prayed for on that hot and muggy Sunday two days before the procedure. On that day, we visited the Ohel in Queens, N.Y., the resting place of the Lubavitcher Rebbe—Rabbi Menachem Mendel Schneerson, of righteous memory. Although Mason had been praying with devotion and a minyan all along, the gravesite of someone holy provides a more powerful, “static-free” environment for prayers to ascend to G‑d.

By the time we had finished praying, Mason began experiencing intermittent pressure that was more severe than it had been previously. He felt intense pressure in his chest. Upon returning home, he called his cardiologist, who told him to go directly to the emergency room.

Several tests later, the ER doctors put Mason on Heparin—a blood thinner, and nitroglycerin—a vessel opener. The doctor told Mason that, proverbially speaking, he was a few beats away from having had a heart attack, which would have made surgery more complicated. The cardiologist inferred that the pain might have been caused by a piece of plaque that dislodged from the vessels.

Mason, who straddles the world of both science and faith, attributes, at least partly, his prayers said at the Rebbe’s gravesite, where the severe pain first began, to averting the heart attack. Getting to the emergency room on time before a full-fledged heart attack was indeed a good outcome. Gam zu letovah, “This, too, is for the best.”G‑d had orchestrated the chest-crushing pains that sounded the alarm for our benefit.

Mason’s cardiologist performed the cardiogram a day early. It showed that he now had occlusions far greater than the initial 75 percent and almost complete occlusion in the left-anterior descending artery, often known to be fatal. Stents—he would have required seven—would not be the most effective treatment, especially given that Mason’s vessels were of an irregular shape. After several specialists met, they determined that quadruple bypass heart surgery would provide Mason with the best outcome by far.

The next day, a surgeon specializing in open-heart surgery spoke with Mason and me. Despite the more invasive nature of this procedure and its longer duration, we both felt a sense of relief that he was eligible for the procedure deemed best for him. With deep faith in G‑d, we believed Gam zu letova, “This, too, is all for the best.”

As with any surgery, and more so major ones, the only certainty is some level of uncertainty. Mason went into surgery at 4 p.m. in a premier hospital. We had already learned that this cardiac specialist was steadfast and meticulous, and that it often took him seven hours to perform the surgery. But by the time the clock read 1 a.m., Mason was in surgery for close to nine hours and I was beginning to panic.

A very close friend who joined me during the evening waiting room shift stayed until I received the call from the surgeon. He reported that the procedure took longer because Mason was bleeding profusely and required a blood transfusion. The surgeon, whose hands we believe are directed by G‑d, had to reopen the stitches in Mason’s chest to ensure that there were no other vessels or organs causing the bleeding. He didn’t release Mason from the operating room until he was 100 percent sure that Mason was OK. That worked for me, and more importantly, for my husband!

It wasn’t until 2 a.m. that I was first able to see Mason, who gained consciousness and alertness about six hours later. Our Chabad of the Beaches Rabbi Eli Goodman visited Mason in the ICU to bring him cheer and help him observe the commandment of tefillin: wrapping small boxes containing the words of the Shema around his head and arm.

Many years ago, when first introducing him to this commandment, our rabbi had told Mason, “In order to get hooked up from above, you have to get hooked up from below.” Mason has been wrapping tefillin ever since.

Two weeks after the surgery, Mason had an appointment with his cardiologist. Although his chest had healed as expected, the cardiologist was alarmed that one of his legs was red and swollen. Once again, he sent Mason to the emergency room. The vascular surgeon told him that he arrived in the nick of time. A day or two later, the infection from the site where two veins had been removed for his heart surgery might have resulted in a dangerous case of sepsis. Had he not seen his cardiologist that day and immediately followed his advice, the results could have been dire. Mason underwent another surgery, this time to open and drain the infection from his leg. We thought to ourselves, Gam zu letova—all the events had been orchestrated for our benefit.

During his stay in the hospital, Mason was awoken each morning at 5:30 to have his blood drawn. Immediately afterwards, he wrapped his tefillin, said the morning prayers, and engaged in his daily Talmud study. Despite all the distractions, including knowing that he would need to face the pain of having his deep, down-to-the nerve wounds undressed, cleaned and redressed twice daily, Mason continued his prayers three times daily.

He said it brought stability to his day and gave him confidence. He felt that if he could pray intently amid the changing of his intravenous antibiotics bag, machines beeping and the ongoing nursing visits, he could do just about anything. That includes being a better person. And a better Jew.

All of that he has become. The hardship made Mason more appreciative, and our love has grown even greater from this shared difficulty. Seven weeks after surgery—and contrary to the belief of a physician assistant—Mason is back to doing yoga, albeit a slightly modified version. The wounds in his legs have healed. He has been cleared by his home nurse not only to continue his life, but to relish a longer, healthier one. It has, indeed, been a good outcome. Gam zu letova!

Judaism is filled with folklore about people accepting what appears to be disappointing and difficult circumstances. But these religious sojourners often ultimately discover that regardless of how bleak the situation looks, it can turn out for the best.

Of course, no one ever seeks illness or heartache. But if we look carefully, we often see G‑d’s loving hands at work. Even when the opposite of what we hoped for happens, we can, at a minimum, learn lessons and from that become improved versions of ourselves. With deep faith in the big picture, we have the ability to realize that everything that happens is for the good, regardless of whether we’re in tune with that notion. This belief is encapsulated by the Jewish saying, Gam zu letova, “This, too, is for the best.”