A man who gained internet fame as "Kai the Hatchet-wielding hitchhiker" was sentenced to 57 years in prison Thursday in the beating death of a New Jersey man almost six years ago. Jurors in Union County convicted 30-year-old Caleb "Kai" McGillvary last month in the May 2013 death of 73-year-old lawyer Joseph Galfy.

McGillvary gained some online fame after intervening in a 2012 assault on a California utility worker in which he described using a hatchet to fend off a further attack.

Authorities said McGillvary met Galfy in New York's Times Square days before the murder, and the defendant stayed at Galfy's home, where the victim's body was found. Investigators said surveillance footage, cell phone data and other forms of evidence were used to identify McGillvary as a suspect, reports CBS New York.

Get Breaking News Delivered to Your Inbox

McGillvary, who is Canadian, was arrested in Philadelphia days later.

McGillvary alleged that he acted in self-defense following an attempted sexual assault, but prosecutors said his statements were inconsistent and also cited the victim's extensive injuries.

The county medical examiner testified that the victim – "who stood 5-foot-5, weighed 230 pounds, and had a stent in his chest due to a heart condition" – sustained numerous serious blunt-force injuries to his face, head, neck, chest, and arms, including three skull fractures, four broken ribs, and severe contusions, abrasions, and bleeding, reports CBS New York.

Prosecutors also said McGillvary cut his long hair and fled the state after the murder.

McGillvary had several expletive-laden outbursts during his trial and sentencing, and a judge called him a "powder keg of explosive rage," reports NJ.com.

Speaking before he was sentenced, McGillvary called the trial a "sham" that "railroaded an innocent man," the website reports.

Galfy had reportedly been a partner with the Rahway-based law firm of Kochanski, Baron and Galfy, PC. He was a military veteran who reached the rank of Major while serving in the U.S. Army from 1965 to 1970.