A man who apparently guzzled a bottle of poison in court upon hearing guilty verdicts pronounced against him at a June trial learned his sentence Friday.

Todd Wesley Eckley, 48, was sentenced to 96 years in prison in a case that involved repeated rapes of a 10-year-old boy.

The hearing before El Paso County District Judge Barney Iuppa went smoothly — a switch from Eckley’s June trial, which ended with him draining an ice tea bottle he claimed contained oleander, a poison that can be fatal if ingested in sufficient quantities.

Eckley was treated at a hospital — and then returned to the El Paso County jail to await sentencing.

Eckley is a registered sex offender who served four years in prison after a previous sex offense against a child, authorities said.