NEW YORK (CBSNewYork/AP) — A U.S. judge gave permission on Wednesday for a psychologist to examine infamous Mexican drug lord Joaquin “El Chapo” Guzman at the New York City jail where he’s locked up in a drug-trafficking case.

Guzman smiled and waved to his wife and two young daughters in the gallery as he entered a Brooklyn courtroom for a brief pretrail hearing where the defense sought approval for the examination after months of complaining about strict jail conditions.

READ MORE: New York Weather: CBS2’s 10/28 Thursday Morning Forecast

El Chapo in court

A sketch of Joaquin “El Chapo” Guzman waving to his wife and daughters in Brooklyn federal court on Nov. 8, 2017. (credit: Jane Rosenberg)

“His memory is failing. He’s not remembering things,” defense attorney Eduardo Balarezo said outside court when asked about the condition of his client. “I don’t want it to get to the point where he can’t assist in his defense.”

U.S. District Judge Brian Cogan approved the examination but said Guzman would only be able to talk to the psychologist without any physical contact.

Guzman, 60, was brought to the United States in January and pleaded not guilty to charges that he oversaw the Sinaloa drug cartel, a multibillion-dollar international drug trafficking operation responsible for murders and kidnappings. In Mexico, he had gained notoriety by twice escaping from prison, the second time in 2015 via a mile-long tunnel dug to the shower in his cell.

Balarezo said the conditions at the federal lockup in Lower Manhattan where Guzman is being held are harsh, 1010 WINS’ Carol D’Auria reported.

Court papers from the defense claim that Guzman is allowed outside his cell only one hour per day and has had only one visit with his daughters. They say the cell is “frigid” and lacks fresh air.

“He is basically locked up in his cell, the only human contact he has is with the defense team. And although we do visit him on a daily basis he still spends the bulk of his day locked up in his cell with the light on, cold,” Balarezo said.

READ MORE: Heat Pull Away To Beat Nets

In recent weeks, Guzman “has suffered a marked deterioration in his mental state,” the papers say, including having hallucinations, bouts of depression and headaches.

“It is plain to the defense team that something is not right with Mr. Guzman,” the papers say.

“I’m alleging that the conditions that he’s been under for the last nine months or so are affecting him,” Balarezo said. “They’re affecting his memory, they’re affecting his ability to relate information that I need as his lawyer to defend him.”

The U.S. government has said severe restrictions are necessary for Guzman in part because he used coded messages, bribes and other means to continue operating his drug empire from behind bars and arrange escapes.

The attorney for Joaquin “El Chapo” Guzman, Eduardo Balarezo, talks with the media after a hearing November 8, 2017 outside Brooklyn Federal Courthouse.(Photo by Don Emmert/AFP/Getty Images)

In a letter to the court dated Tuesday, prosecutors said they will use thousands of documents and recordings as evidence against Guzman at a trial next year. The evidence includes videos “related to a 1993 shooting at Guadalajara airport, the defendant’s safe houses, the defendant’s 2015 escape from prison and a law enforcement operation to recapture the defendant,” the letter says.

According to news reports, a rival drug gang tried to assassinate Guzman at the Guadalajara airport in 1993, but instead killed Roman Catholic Cardinal Juan Jesus Posadas Ocampo, outraging Mexicans.

Guzman’s trial is set for April 2018.

MORE NEWS: FDNY Planning Big Anti-COVID Vaccine Mandate Demonstration For Thursday Morning Outside Gracie Mansion

(© Copyright 2017 CBS Broadcasting Inc. All Rights Reserved. The Associated Press contributed to this report.)