A Brooklyn man who spent the past 26 years in prison for murder walked out of court a free man Thursday afternoon — after a witness in his case admitted she was lying.

Carlos Weeks, 46, was exonerated on Thursday afternoon after an investigation by Brooklyn DA Eric Gonzalez’s office into his case.

An elated Weeks hugged his lawyers as he walked out of Brooklyn Supreme Court — telling reporters he felt no anger toward the people who put him behind bars.

“I’m great,” Weeks said when asked if he held any resentment. “I just want to say I’m feeling good. I’m happy to be out.”

Weeks was convicted of second-degree murder and first-degree assault after he was accused of fatally shooting a man and wounding a 10-year-old girl outside Bedford-Stuyvesant’s Tompkins Houses in 1993.

He was sentenced to 27 years to life in prison.

Two sisters testified that they saw Weeks shoot Frank Davis, 21, from their 12th-floor window across the street.

But asked recently if she actually saw what transpired, one of the sisters, Lorraine Taylor, teared up and said, “No,” telling CRU investigators, “There was so much pressure” to testify, according to the DA.

Her sister, Carmella Taylor, claimed she did not remember testifying or telling cops in 1993 that she saw Weeks shoot the man — a claim the CRU found “implausible.”

After vacating the charges against him Thursday, Brooklyn Supreme Court Justice Dineen Riviezzo apologized to Weeks and wished him well.

“There are no words this court can possibly say to give Mr. Weeks back the years that he spent in prison,” she said.

The unit has overturned 27 convictions over the past five years. Another 80 cases are pending.

“Today we continue to see why the search for the truth must continue after a case is considered closed and the conviction has been received and someone has been sent to jail,” Gonzalez said outside court.

“I wish Mr. Weeks a heartfelt good luck. I apologize to him for what happened to him and we have to make sure we continue to root out these miscarriages of justice.”

Law firm Davis Polk & Wardwell LLP took up Weeks’ case in 2015 along with The Legal Aid Society and presented their evidence to the CRU in October 2017.

“This is a happy day for Carlos and his family — a long time in coming — but we have other clients with matters pending before the CRU,” said attorney Elizabeth Felber of The Legal Aid Society.

“We urge that office to investigate those matters promptly so that other wrongfully convicted individuals can experience the vindication that Carlos has experienced today.”