A man who was mocked online after he was recorded shaving at his seat on a commuter train headed out of New York City said he was just trying to clean up after days spent in a homeless shelter.

Anthony Torres, 56, told The Associated Press that the people judging him on social media don't know the struggle he's been through in his life.

"My life is all screwed up. That's the reason I was shaving on the train," he said.

A fellow passenger on a Thursday evening New Jersey Transit train took video of Torres, sitting in his seat, steadily swiping away at his lathered face and tossing the shaving cream from the razor onto the floor. The video, posted on Twitter, had 2.4 million views by Monday afternoon. Another video showed a clean-shaven Torres with a beer in his hand.

The self-grooming earned its share of negative comments on the internet, with insults like "slob," ''animal" and "nasty." Others humorously lauded his steady hand with a razor. A few cautioned against passing judgment and suggested people didn't know the whole story.

The truth, Torres said, is that the video captured him at a vulnerable moment. He had been homeless and staying in a shelter in New York City. He'd reached out to his family for help. A brother gave him money for a train ticket, which he was using to get to another brother in southern New Jersey.

Torres grabbed the Northeast Corridor train from Manhattan's Pennsylvania Station around 7 p.m. Thursday, headed toward Trenton, New Jersey.

He said he left the shelter before having a chance to shower and clean up and wanted to look "presentable."

"I don't want to say that I'm homeless, let everybody know," he said. "That's why I was shaving."

Torres has had a hard life, said his brother Thomas Torres, 57, whose house in Atco, New Jersey, was where the younger Torres ended up after the train ride and a subsequent bus trip.