For 24 years, jogging was my main form of exercise. So it was frustrating and disheartening — a bit demoralizing, too — when I had to switch to walking 12 years ago because of a slow, painful recovery from a nasty bout of peritonitis, an infection in the lining of my stomach.

Like many young men in our fast-paced culture that values infallibility, I considered walking somehow not real exercise, and a submission to vulnerability. Once my body healed enough, I returned to jogging and didn’t look back.

During research for a book about what boys and men need to thrive and survive in a time when many of them are in crisis, I heard scores of men under 50 say they would never walk for exercise. Their reasoning: its reputation as a “softer” form of exercise embraced particularly by women and older men; it paled in comparison to weights and strength training; it was a slow, boring movement that required too much time.

These attitudes explain the chasm in gyms where you’ll find far more women on treadmills and elliptical machines, while the vast majority of guys are grunting on free weights and resistance machines. If these younger guys use treadmills, they’re using them just to run a quick mile.

Matthew Harber, director of the Clinical Exercise Physiology Laboratory at Ball State University in Indiana, said that for men who grew up playing organized sports it’s possible they “associate ‘exercise’ with competition.” This can create a mind-set that values only “high intensity exercise . . . [that] has a competitive angle to it. Perhaps it’s akin to the ‘no pain no gain’ adage that is not true,” he wrote in an email.

Carol Ewing Garber, past president of the American College of Sports Medicine and the program director of the graduate program in applied physiology at the Teachers College at Columbia University, said in an email that for many boys and younger men, the “gym scene” may fit with their perceptions of what “masculine” exercise should look like, especially when it comes to intense sweating.

“After all, we don’t see media images of men going for walks . . . we just don’t see a lot of men in our daily life who walk and are portrayed as ‘masculine.’ ” she said. “While there is no doubt that walking is a healthful activity for both men and women, walking may be seen as something only for women or older men.”

Michael Heisler, 56, agrees. The part-time tennis teaching professional prefers weightlifting, strengthening exercises in the gym and “getting my cardio on the court.” Like many men, he would rather not exercise at all than resort to walking.

“The idea of walking feels like I’m throwing in the towel,” he said.

While studies have shown that weightlifting, resistance and core training burn fat and provide cardiovascular benefits, research likewise has shown that walking can be a perfect whole-body exercise, a lower-impact workout with far fewer hazards. It can be done anywhere, anytime and with no expenditure of money.

While it may not be as cardio-strenuous as, say swimming or jogging, it has been shown to yield the long-term physical, mental and emotional health benefits men (and women) need throughout their lives. Studies also have found that regular walking was associated with a lower risk of stroke, of cognitive impairment and of cardiovascular disease.

Once middle age and its vicissitudes (back injuries, shoulder bursitis, ankle strains) start to hit, a gentler form of exercise starts to look more appealing. At least that is what happened to me.

Although I returned to running after my recovery from peritonitis, one unexpected outcome during that slower paced year stuck with me: With every step I took during those plodding walks, a strange gravity drifted down through my legs, my feet and into the sidewalk. It made me feel more connected, more grounded, at a time when I was all too eager to disconnect from my compromised body.

And so two years ago, after I developed what doctors think is mild asthma or exercise-induced bronchoconstriction, I mostly gave up jogging and began walking every day for exercise. Now squarely in middle age, I don’t feel the need to prove anything to anyone — or myself — and the slower speed lets me sink into my thoughts and my body at a time of life when I want to embrace and integrate both.

I also embrace walking these days because it feels, well, fitting in these frantic, fraught times. As a blog post for the Anxiety and Depression Association of America puts it: “Psychologists studying how exercise relieves anxiety and depression suggest that a 10-minute walk may be just as good as a 45-minute workout.”

If this terrifying, historic moment has done anything positive, it has forced us to slow down, to be more present, more aware.

I walk now not just to get good exercise but to feel that connection to my breath, my feet and to the earth.

Andrew Reiner, author of the upcoming book, “Better Boys, Better Men: The New Masculinity That Creates Greater Courage and Emotional Resiliency,” teaches a seminar on masculinity at Towson University.