‘Tis the season, all right. But unlike the 12 days of Christmas, cold and flu season doesn’t discriminate between naughty or nice.

The best medicine remains the flu shot — and to a lesser extent, regularly washed hands. But exercise also plays an important role in warding off unwanted germs.

According to various studies, regular exercise boosts the immune system by increasing the flow of antibodies — the first line of defense against bacteria and viruses.

“Of my patients, the ones that exercise a lot, I just don’t see them that much,” said Dr. Amy Fogelman, a physician at Mass General Hospital. “I certainly do feel like people that are healthier overall have stronger immune systems and are less likely to get sick.”

Of course, cold and flu bugs will inevitably hit their mark. Exercise can then go from helpful to harmful, depending on the location of the virus.

“If you’re sick from the neck up, then it’s okay to exercise,” Dr. Fogelman said. “But from the neck down, you shouldn’t, because there might be something going on with your lungs.”

In concert with a sound body in the fight against flu is a sound mind, says Victoria Garcia Drago, a certified yoga instructor in Boston.

“The cold season is also holiday season, and a lot of people are under stress,” Garcia Drago said. “When you’re stressed out, your immune system gets wiped out. When you’re at peace with your body, you’re more likely to want to exercise, to eat and sleep better. If you have a stronger mind, you’re less likely to get anything.”