If you ask the grooms and trainers readying for the Preakness Stakes, they’ve all seen it: tucked into one of the stalls or munching on the abundance of hay lying around.

It’s much smaller than the thoroughbreds it’s sharing the stables with — and it has horns.

That’s right — there is a goat roaming Pimlico. But, why?

Well, according to Sue McDonnell of the University of Pennsylvania School of Veterinary Medicine, it’s for the horses’ mental health.

The Baltimore Banner thanks its sponsors. Become one.

Mage works out Wednesday with a handler and a support horse at Pimlico Race Course. (Jessica Gallagher/The Baltimore Banner)

Commonly known as “companion animals,” goats (along with ponies, donkeys, dogs and even chickens) have been used for decades in equestrian sports to help calm anxious horses.

“Most racehorses are pretty amped up because of their exercise schedule and lack of turnout to run freely,” McDonnell said. “Those companion animals can actually help with that animal’s natural pattern of eating and resting as well as just overall relaxation.”

The efficacy of these emotional support animals is built into horses’ biology, McDonnell added. Equines descended from a prey species roaming open fields in large herds, sharing the responsibility of alerting the group of danger or assuring that the coast is clear.

Even as horses were increasingly domesticated, according to McDonnell, this biological need for community and reassurance hasn’t left them — and often isn’t fulfilled for racehorses spending a lot of time alone or constantly moving stables.

For decades, companion animals have been stepping in to fill this biological void. Take famed Depression-era champion Seabiscuit. He rose to renown with the help of his emotional support animal, a blonde pony named Pumpkin. Even after he retired, Seabiscuit and Pumpkin remained companions.

The Baltimore Banner thanks its sponsors. Become one.

These support animals don’t have any special training or skills, according to McDonnell. The only real requirement? They need to be super chill.

But, even then, there’s an aspect of matchmaking involved.

Longtime horseman and former trainer Jim Newman has seen racehorses outright reject companion animals, and recalled one time in particular where a horse bucked a goat straight out of its stall.

“The goat survived, though,” Newman assured me.

Over the last week, Kentucky Derby winner Mage struck up a brief friendship with a white horse in the stables of Pimlico. Though Mage doesn’t run anxious, according to assistant trainer Gustavo Delgado Jr., he does sometimes seek out companionship, like any herd animal.

The Baltimore Banner thanks its sponsors. Become one.

But the budding relationship didn’t last long.

“He didn’t really like him,” Delgado said. “He tried to bite him.”

The white pony was slightly bigger than Mage, Delgado added, and the champion horse wasn’t about to be outshined.