Updated

A man who gained internet fame as "Kai the Hatchet-Wielding Hitchhiker" was sentenced to 57 years in prison Thursday for the beating death of a New Jersey man he had met in Times Square.

Caleb McGillvary will have to serve at least 85% of his sentence under terms imposed in state Superior Court in Union County.

The 30-year-old Alberta, Canada, native was convicted last month of killing 73-year-old lawyer Joseph Galfy at Galfy's New Jersey home in May 2013. Authorities said the two met in New York City and the defendant stayed at Galfy's home.

McGillvary alleged he acted in self-defense following an attempted sexual assault. Prosecutors said his statements were inconsistent and also cited the victim's extensive injuries. Galfy was found beaten to death in his bedroom, wearing only his socks and underwear.

Several days after Galfy's death, an employee at a Starbucks in Philadelphia recognized McGillvary, and he was arrested at a bus station.

A few months before meeting Galfy, McGillvary gained a measure of fame after intervening in an attack on a California utility worker.

In a TV interview viewed millions of times online, he described using a hatchet he was carrying to repeatedly hit a man who had struck the worker with his car, and also fend off a further attack on two women.