A 43-year-old MAX train passenger caught viewing child pornography on his cellphone by another rider was sentenced Friday to 366 days in prison.

A female passenger spotted Joshua James Roberts also looking at a photo of a sexual assault of an animal, investigators said.

The woman snapped photos of Roberts looking at the graphic pictures and called 911 immediately on Dec. 12, 2017.

Police confronted Roberts at the next stop, the Rose Quarter station, where Roberts stepped off the Blue Line train, investigators said.

Roberts was charged with five counts of second-degree encouraging child sexual abuse and one count of encouraging sexual assault of an animal. As part of a plea agreement, he pleaded guilty in Multnomah County Circuit Court to one count of second-degree encouraging child sexual abuse.

Roberts already was required to register as a sex offender because of previous convictions, including criminal sexual penetration of a minor and contributing to the sexual delinquency of a minor in 2001 in New Mexico and three counts of first-degree sexual abuse in 2003 in Oregon. Court papers also say he was deemed a “violent sex offender” in 1999 in Illinois.

Upon his latest arrest, Roberts told jailers that he had a 7-month-old child. The child was in the custody of the state Department of Human Services at the time, court papers state.

Roberts said he was homeless and living in a tent near a graveyard.

Brent Weisberg, a spokesman for the Multnomah County District Attorney’s Office, said if Roberts had been convicted of all of the charges against him, Oregon sentencing guidelines would have called for a prison sentence of 13 to 14 months. The plea agreement resulted in a reduction of one to two months, Weisberg said.

Roberts didn’t download the graphic images onto his phone, rather he was viewing them on a website, Weisberg said. If Roberts had downloaded the photos, he would have faced a longer prison sentence, Weisberg said.

-- Aimee Green

Visit subscription.oregonlive.com/newsletters to get Oregonian/OregonLive journalism delivered to your email inbox.