According to the criminal complaint against him, James Harris Jackson, 28, told a police officer that he had come to New York from Baltimore several days before the fatal March 20 attack on Timothy Caughman “for the purpose of killing black men and had stalked numerous potential victims.”

In the end, however, he chose Caughman. As the 66-year-old bent over a trash bin around the corner from his home, gathering bottles to recycle, Jackson attacked him from behind with a 2-foot sword and walked off, prosecutors say. A bleeding Caughman staggered into a police station and later died at a hospital.

On Thursday, Jackson was charged with murder as a hate crime. He said nothing in court.

“The defendant was motivated purely by hatred,” said Assistant District Attorney Joan Illuzzi, who added that the charges could be upgraded, “as this was an act most likely of terrorism.”

He came to New York last week to make a splash in the media capital of the world by killing as many black men as possible, authorities said.

After seeing his picture in the news, Jackson turned himself in at a police station. He was armed with two knives and told officers he had tossed the sword in a trash bin in Washington Square Park, officials said. It was later recovered.

Investigators said they were trying to determine exactly what drove Jackson to violence. They planned to search his laptop and phone and interviewed friends and family.

His attorney, Sam Talkin, said if the allegations are anywhere close to being true, “then we’re going to address the obvious psychological issues that are present in this case.”

Jackson was in the Army from 2009 to 2012 and worked as an intelligence analyst, the Army said. Deployed in Afghanistan in 2010-11, he earned several medals and attained the rank of specialist.

Dr. Scott Krugman, chairman of pediatrics at Franklin Square Medical Center in Baltimore and a friend of the family, said the allegations were out of character with his family’s beliefs and the way he was raised.

Jackson’s parents, David and Patricia Jackson, are active members of Towson Presbyterian Church and have two other sons. Patricia Jackson is a former teacher of English-language students in the Baltimore County school system and worked for Well for the Journey, a Christian nonprofit organization that helps people “integrate spirituality into their daily lives in a safe, inclusive space.”

“They’re liberal as liberal can be,” Krugman said. “We were at a dinner party with them and everybody was complaining about the current administration and very open about rights for everybody and making sure we’re not excluding immigrants, everything like that. I’m just beyond shocked right now.”

Timothy Caughman, 66, was stabbed to death in Midtown Manhattan on Monday, March 20, 2017.

CBS New York

In a statement, the Jackson family extended condolences to Caughman’s family and said it was “shocked, horrified and heartbroken by this tragedy.”

Caughman had lived for 18 years in a former hotel in Manhattan, sharing the building with tenants who were part of a temporary-housing program. Caughman was not part of the program; he was a tenant already living in the century-old, seven-story building.

He was “extremely respectful” of his neighbors and building workers, said Svein Jorgensen, the program’s executive director. “He was a great tenant and someone that anyone would be glad to have as a neighbor.” He added: “He was a gentleman.”

Caughman displayed photos of himself with celebrities on his Twitter page, where he also showed that he was proud to have voted in the election. He struck up a longtime Twitter relationship with Shari Headley, the actress who played Eddie Murphy’s love interest in “Coming to America.”

After his death, she tweeted: “My heart is heavy typing this. Timothy Caughman was a fan of mine since 1991. He only spread LOVE. His murder was senseless.”

His family was upset that he was initially portrayed in some news reports as a homeless man with a criminal past. He had a criminal history, but the most recent offense was a low-level pot arrest in 2002.

His cousin Seth Peek told The New York Times that in the 1970s and ‘80s, Caughman worked with young people in Queens as part of a youth program.

“He wasn’t just a vagrant person collecting bottles,” Peek said. “That was not just what his life was. He went to college, and he was concerned with young people in the neighborhood.”