ELIZABETH, N.J. (AP) — A homeless, hatchet-wielding hitchhiker who became an Internet hero earlier this year was arrested Thursday for allegedly beating a New Jersey lawyer to death inside his home.

Caleb "Kai" McGillvary, whose star turn as "Kai the Hatchet Wielding Hitchhiker" came after he intervened in an attack on a California utility worker, was arrested at a Philadelphia bus station, Union County Prosecutor Theodore Romankow said.

"I believe that everyone is a little safer with this person off the streets," the prosecutor said. Philadelphia police could not immediately be reached for comment.

McGillvary was charged with killing Joseph Galfy, Jr., a Clark, N.J., attorney found dead Monday. Romankow said he will be processed and sent to back to New Jersey, where his bail is set at $3 million.

Galfy's body was found two days after authorities said he met McGillvary in New York City. Galfy, 73, was found wearing only his underwear and socks by police who went to his home to check on his well-being.

Statements posted on McGillvary's Facebook page following the homicide indicated the encounter was sexual in nature, Romankow said, though he declined to go into specific detail.

On his Facebook page, McGillvary's last post, dated Tuesday, asks "what would you do?" if you awoke in a stranger's house and found you'd been drugged and sexually assaulted. One commenter suggests hitting him with a hatchet — and McGillvary's final comment on the post says, "I like your idea."

A hatchet helped give McGillvary a brief taste of fame in February when he gave a rambling, profanity-laced 5-minute interview to a Fresno, Calif. television station about thwarting an attack on a Pacific Gas & Electric employee. The interview went viral, with one version viewed more than 3.9 million times on YouTube. He later appeared on ABC's "Jimmy Kimmel Live!"

Kimmel asked him what people were saying to him since the Feb. 1 incident. "Hey, you're Kai, that dude with the hatchet," he responded.

Story continues

McGillvary, who said in his TV appearance he prefers to be called "home-free" instead of homeless, traded on his newfound celebrity to meet fans across the country, according to Romankow.

McGillvary met Galfy on Saturday in Times Square, then spent at least two nights at his home on a cul-de-sac in Clark, a quiet community about 20 miles west of New York, Romankow said. His movements after that included two trips to meet a fan in Asbury Park, a trip to Philadelphia and another to Glassboro in southern New Jersey before he took a train bound for Philadelphia, authorities said.

McGillvary swiftly gained notoriety in February after he intervened in an apparently unprovoked attack that led to charges including attempted murder.

McGillvary said he was riding in a car with a man who veered into the worker, got out of the car, then said "I am Jesus and I am here to take you home" before attacking. McGillvary said he then pulled a hatchet from his backpack and struck the driver in the head several times to subdue him, The Fresno Bee reported.

"That woman was in danger," Kai told KMPH-TV. "He just finished, what looked like at the time, killing somebody, and if he hadn't done that he would have killed more people."

Last month, the driver entered a plea of not guilty by reason of insanity, according to The Fresno Bee.

In his television interview, McGillvary also said he'd once intervened in what he called a domestic violence situation.

A man "starts beating up on this woman who he calls his," McGillvary told the television station. "I started smashing him in the head and the teeth."

McGillvary also goes by the names Kai Lawrence, Caleb Kai Lawrence and Kai Nicodemus, prosecutors said.