A Maryland white supremacist hobbled into Manhattan court Wednesday and admitted to fatally stabbing a black New Yorker.

James Jackson, 30, pleaded guilty to six counts of second-degree murder, terrorism, hate-crime and weapons charges in exchange for a sentence of life in prison for slaughtering Timothy Caughman, 66, in Midtown on March 20, 2017.

“You stabbed Timothy Caughman with a sword with the intention of causing his death?” asked Justice Laura Ward in Manhattan Supreme Court.

“Yes,” he replied, adding that his goal was to start a race war. He recently broke his foot while in custody.

Had Jackson been convicted at trial, he would have gotten the same sentence. One of his defense lawyers, Patrick Brackley, said he had advised Jackson against taking the plea.

“White nationalism will not be normalized in New York,” said Manhattan District Attorney Cy Vance Jr. in a statement. “If you come here to kill New Yorkers in the name of white nationalism, you will be investigated, prosecuted, and incapacitated like the terrorist that you are. You will spend your life in prison without the possibility of parole because there is no place in our city or our society for terrorists – ‘domestic’ or otherwise.”

Before the plea, Jackson’s other defense lawyer, Fred Sosinsky, said that they had just learned from prosecutors that the intelligence division of the NYPD interviewed Jackson in jail in early December.

These detectives have no involvement in the case and interviewed Jackson without counsel present in violation of state law, Sosinksy said.

Vance said he would conduct an investigation into the NYPD’s unauthorized interview of Jackson.

Jackson is due back in court Feb. 13 for sentencing.

Caughman was stooped over a pile of trash on West 36th Street near Ninth Avenue scavenging for cans and bottles when Jackson plunged a sword into his back.

The victim fell to the ground and put his hands up as Jackson repeatedly thrust the blade into his chest then fled.

Caughman was a lifelong New Yorker and avid autograph hound, whose friends and family have attended many of Jackson’s court appearances.

After the slaying, Jackson spent hours looking for his next target as he clutched two knives in either pocket but grew discouraged and turned himself in to cops the next day.

In a chilling confession tape, Jackson told police he had traveled from the South to New York with one purpose: to kill blacks. The Army veteran had stalked as many as 15 people before setting his sights on Caughman.

“I think we should just preserve the best people and get rid of all the dead weight,” he said in the disturbing videotaped interview played at a pretrial hearing. “In my opinion, blacks are inferior people.”

By committing the crime in the Big Apple, he said, he’d hoped to maximize media coverage and “get the governments of the white countries together.”

But as he searched for his next victim, he soon realized that it was too late. “I just seemed like I was seeing interracial couples everywhere,” he said during the interrogation. “This is the new way, and we can’t restore what we had 50 years ago.”