WALPOLE, Mass. — His owners are calling their pet Max the Miracle Dog because he escaped unharmed after being run over by a commuter train.

Boston television station WCVB reported that Max sneaked out of his Walpole home on Friday morning and wandered onto some nearby train tracks. The engineer, Kym Berry, spotted him and slammed on the brakes.

“I blew the horn and put on the bell and he jumped right in the middle of the gauge and just kept running. So I put the train in emergency and he went right underneath the train. And it turns out, he came out the third coach back,” Berry said.

He came out in perfect condition.

“Thank God, he was … not a scratch on him. He was so little that he went under the train and he was fine. Not a scratch,” his owner Robin Lennon said.

At that point, the assistant conductor Pete Tomasini decided to take Max under his wing until they could locate his owners. They made Max an honorary conductor for the day. The passengers loved him, and Max seemed happy, too.

“Every time I stopped he came up and gave kisses. He was very friendly, his little bum was wiggling, he was wagging his tail, he was happy,” Berry said.

His owners said Max seemed unaffected by the ordeal, although he seemed to need a little recovery time.

“When he did come home he slept for 12 hours straight. He was totally exhausted,” Lennon said.

They were praising MBTA workers for their quick-thinking response and for taking care of the pooch until his owners could be found.