SAN FRANCISCO — The convicted Aptos camp counselor and tutor who molested at least two boys and victimized other children was sentenced Wednesday in a San Francisco federal court to 30 years in prison despite his relatives’ and friends’ pleas for leniency.

The sentencing — rendered by District Court Judge Charles Breyer — followed resistance from convicted child predator Ryan Spencer, who for 21 days in fall 2018 defied court orders to unlock his confiscated electronic devices. Once he cooperated, the devices revealed Spencer’s sexual assaults of a boy he babysat and images of other boys’ genitals, Assistant U.S. Attorney Julie Garcia wrote in a sentencing memorandum July 3.

Garcia described escalating violence against children by a boy who made himself of service in multiple Aptos community organizations.

“Spencer saw the boys in his care as sex objects and he acted accordingly,” Garcia wrote. “The effects will be felt for years to come.”

Breyer levied the sentence recommended by the U.S. Attorney’s Office: three decades in federal prison, 15 years of supervised release and restitution of an amount to be determined to support the victims.

Spencer, 21, and Bryan Petersen, 26, of Tiburon traded child pornography they produced while having gained special access to children as babysitters. Petersen, who was 24 when FBI agents arrested him at his Tiburon home April 26, 2017, pleaded guilty in July 2017 of possession of child pornography; receipt of child pornography; distribution of child pornography; production of child pornography; and conspiracy to distribute and receive child pornography.

Spencer pleaded guilty in October of two counts of production of child pornography, conspiracy to distribute and receive child pornography, distribution of child pornography, receipt of child pornography, possession of child pornography and contempt of court, according to the U.S. Attorney’s Office.

Spencer, an Aptos High School graduate who worked as a counselor and babysitter, admitted from March 2015 to April 2017, when he was arrested, Spencer conspired with Petersen to trade child pornography they produced, according to court documents.

Both sought roles with access to children to exploit them, prosecutors said.

In Spencer’s sentencing, court documents shed light on a depraved scheme to hurt children.

“Spencer presented a carefully cultivated image to the families for whom he babysat: a CPR-certified camp counselor and tutor who wanted to become an elementary school teacher; an older brother and role model to young boys; a nice young man from a well-to-do family,” Garcia wrote.

In Spencer’s résumé — attached in his court file — he touts his experience working with children — “from toddlers to teenagers — as a cabin leader, babysitter.”

He tutored children with homework and worked, “maintaining order in large groups” of children while employed by a Santa Cruz County Parks worker.

Spencer was arrested in April 2017.

“But rather than let his arrest be a wake-up call, accept responsibility and attempt to atone for his actions, Spencer doubled down. He refused to unlock electronic devices the FBI had seized under a search warrant, hindering law enforcement’s efforts to identify the children he had victimized,” Garcia wrote.

Who is Ryan Spencer?

Spencer’s attorney, Shannon Dorvall, describes her client’s troubled past in a motion filed July 3.

Spencer suffered anxiety after being bullied — even threatened with a knife — and forced to have oral sex with an older boy, according to court documents from his elementary school years. He became an adept graphics designer and had won awards for his work. Many people in Aptos knew Spencer and recalled his charm. Court documents reveal how he habitually checked in on his teachers in middle school just to ensure they were OK.

He was an avid reader. He played Little League baseball, participated in a chess club, but shortly before his teens, he “began feeling sexually confused and sought out others online to help him understand what was happening,” according to court documents.

There are 15 support letters packing Spencer’s court file. Relatives and friends have chosen to remain part of Spencer’s life in prison by communicating with him periodically.

One of Spencer’s relatives accused Petersen of victimizing the younger would-be child molester.

“Ryan was taken advantage of at such an integral part of his development,” Spencer’s sister wrote of her brother, referring to him as a 13 year old.

A friend’s father who teaches kindergarten in the Pajaro Valley Unified School District, wrote that Spencer was socially awkward and a target of bullying.

“He was easier to manipulate and control,” his friend wrote, also asking the court not to impose a 30-year prison sentence.

Another Spencer family friend wrote that he is remorseful about his actions. “I hope you will consider a sentence that will allow him to be a son again and a big brother again,” she wrote.

A restitution hearing is scheduled for 1:30 p.m. Sept. 18 in San Francisco.