A man who was mocked online after he was recorded shaving at his seat on a New Jersey commuter train 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,” he said. “That’s the reason I was shaving on the train.”

On a Thursday evening, a fellow passenger on a 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 pm 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.

They grew up poor with four other brothers, raised on a farm in Hammonton, New Jersey, about 35 miles (56 kilometers) outside Philadelphia.

Anthony Torres said he worked a number of different jobs, including casino security guard and then construction. He moved to wherever the work was, like Florida, where his adult son lives. He said he has spent time living in motels or sleeping in bus depots.

Medical conditions have also been a problem, with Torres saying he had two strokes in the past two years.

But Thomas Torres said that, even growing up, his brother would make short-sighted decisions with money, or not think of the impact of his actions, like shaving in public in a train compartment.

“When he did what he did, that to him was normal,” Thomas Torres said. “He’s not that kind of person that does it because of spite or because he wants the attention.”

Anthony Torres said he didn’t realise he was being filmed on the train. When he found out the video was circulating on the internet, he was amazed and a little upset.

“I never thought it would go viral, people making fun of me,” he said.

Thomas Torres said they reached out to media because he thought it was important for people to hear his brother’s side.

“Maybe people will have more feeling knowing what this kid’s been through,” he said.