Updated

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 jail where he's charged in a drug-trafficking case.

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

"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 transferred 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.

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.

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.

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.

At trial, the government also is expected to rely on the testimony of cooperators with inside knowledge of the drug cartel. The defense is certain to try to attack their credibility.

The cooperators "are either going to have already pled guilty, or have already been sentenced, or are going to be facing life, or facing 20 or 30 years," Balarezo told reporters. "And every single one of them is going to be here trying to reduce their sentence."