A Brooklyn judge ordered a freed man back into custody Friday, following an appeals court decision earlier this week that reinstated his 1998 murder conviction.

Tasker Spruill was freed 14 months ago when Judge Michael Gerstein vacated the guilty verdict that had kept him imprisoned for more than 23 years. Spruill had been sentenced to 25 years to life for the fatal 1993 shooting of reputed drug dealer Tracy Thomas.

Gerstein tossed Spruill’s conviction in March 2017, citing procedural misconduct. Gerstein found that trial prosecutor Stan Irvin had knowingly allowed a key witness, Shawn Newton, to be coerced into interviews without Newton’s consent, and to falsely testify before Spruill’s jury.

The appeals court said Irvin had played by the rules, and outside the courtroom Friday, a red-eyed Spruill said he “never in a million years” thought he would be sent back to prison.

The 51-year-old, who has maintained his innocence from the start, had just two days to say goodbye to his loved ones before being shipped back behind bars.

“It’s devastating,” he said, tears in his eyes. “I’m angry with the decision, but I respect it.”

Spruill said he was most worried about “dying in prison.”

It was a quick and somber proceeding, with Gerstein reiterating the appeals court’s Wednesday decision remanding Spruill. Neither prosecutors nor defense attorneys spoke before Spruill tightly hugged his attorneys, and then offered up his wrists to court officers, who gently cuffed him.

Outside court, lawyers Rita Dave and Jabbar Collins said they planned to file a leave to appeal, and fight the appeals court’s decision to reinstate their client’s conviction.

Dave, however, said it’s possible Spruill could come before the parole board before he sees another judge.

“It’s hard to make sense of it,” said Dave. “It’s very rare, I haven’t — we haven’t — seen this before.”