A Texas judge received a public warning Wednesday in response to a months-old incident where he told a deliberating jury that God told him the defendant was innocent.

Comal County District Court Judge Jack Robinson told the Texas Commission on Judicial Conduct that he had been experiencing memory lapses on Jan. 12, the day of the incident, and was going through some personal stress due to a medical condition. He also cited the death of a close friend.

TEXAS JUDGE RELEASES JUVENILE DEFENDANTS AFTER LOSING ELECTION

The judge was presiding over the trial of Gloria Romero Perez, who was charged with sex trafficking and the sale or purchase of a child. When informed of the jury’s guilty verdict, he told them the conviction would be a miscarriage of justice and asked that they deliberate a few minutes more, according to the commission’s report. He later apologized, saying 'When God tells me I gotta do something, I gotta do it,'" officials wrote in the report.

Robinson – who received 18 complaints against him for his statements - reported himself to the commission.

Perez was found guilty anyway and sentenced to 25 years in prison.

The conviction was later declared a mistrial after another judge found Robinson’s rulings were not in accordance with the law and that he made partial comments throughout the trial, the Houston Chronicle reported. Perez is reportedly awaiting her retrial.

CLICK HERE TO GET THE FOX NEWS APP

The public warning falls just short of a suspension but is more severe than a private warning, according to the commission's website.