A funeral has been held for the elderly black man who was allegedly stabbed to death by a sword-wielding "white supremacist" in New York City.

Timothy Caughman, 66, was fatally wounded during the 22 March attack, which took place while he was collecting bottles for recycling.

Caughman was stabbed from behind - in the back and the chest – his injuries discovered when he staggered into a nearby police station.

He was rushed to hospital, but later died from his wounds.

Speaking at the funeral, New York mayor Bill de Blasio said Caughman should be a symbol of the fight against racism, the Associated Press reported.

Alleged white supremacist James Jackson has been charged with one count each of murder in the first and second degrees as an act of terrorism in connection with the case.

Authorities claim Jackson, from Baltimore, travelled to New York to target black men, allegedly in order to make a statement against interracial relationships.

"James Jackson prowled the streets of New York for three days in search of a black person to assassinate in order to launch a campaign of terrorism against our Manhattan community and the values we celebrate," District Attorney Cyrus Vance Jr said in a statement following the indictment.

"Last week, with total presence of mind, he acted on his plan, randomly selecting a beloved New Yorker solely on the basis of his skin colour, and stabbing him repeatedly and publicly on a Midtown street corner. James Jackson wanted to kill black men, planned to kill black men, and then did kill a black man."