James Harris Jackson, 28, of Hampden, Maryland, surrendered to New York City police and confessed Wednesday, two days after a homeless man had a 26-inch sword plunged through his body.

Timothy Caughman, the 66-year-old victim, was a bottle collector who liked to take selfies with celebrities. He died at a hospital after stumbling two blocks for help.

Media accounts say the suspect, arrested about 24 hours after the attack, has harbored racist views at least a decade — which would include the time he served in the Army between 2009 and 2012, including a tour in Afghanistan.

The suspect claimed he is a member of a white supremacist group, according to various media accounts, but authorities have not yet provided further details or named any specific group.

Jackson has “a particular deep-seated hatred for black men romantically involved with white women,” the New York Daily News reported in today’s editions. Such hostile and violent views on interracial relationship are championed by racists following the philosophy of the Phineas Priesthood.

Authorities planned to search the suspect’s Hampden residence, 200 miles from New York City, and forensically examine his computer and cell phone to further investigate his motivation.

It may be on those electronic devices where investigators hope to find “a manifesto explaining his desire and plans that he had wanted to deliver to The New York Times,” the newspaper reported in today’s editions.

William Aubry, New York City’s assistant police chief, told reporters that Jackson was arrested on a charge of second-degree murder, but investigators plan to upgrade the charge by classifying the homicide as a hate crime.

The assistant chief said the suspect, whose security camera image had been televised, surrendered to police and volunteered, “I’m the person you’re looking for.”

Jackson told arresting officers that he chose New York City to make a statement by attacking black men because of the media attention his crime would generate. Security video seemed to corroborate the suspect’s confession, and police recovered the murder weapon, the assistant chief said.

The suspect told police he planned to grab a police officer’s gun and “shoot some people” after stabbing a black man, the newspaper reported, the Daily News reported.

New York City Mayor Bill de Blasio called the killing an “unspeakable human tragedy” and an assault on the city’s inclusiveness and diversity.

Hates crimes have more than doubled this year in New York City, officials say.

“Now it’s our collective responsibility to speak clearly and forcefully in the face of intolerance and violence — here or across the country,” the city’s mayor said.

“We are a safe city because we are inclusive,” de Blasio said in response to the attack. “We are a nation of unrivaled strength because we are diverse. No act of violence can undermine who we are.”