SALT LAKE CITY — A defendant at the center of a multimillion-dollar opioid case in Utah testified Tuesday that he saw himself as helping people get prescription drugs they needed while making money for himself and his friends.

Prosecutors have described Aaron Shamo as the kingpin of the operation that shipped opioids across the country.

But Shamo, 29, downplayed his role when he took the witness stand in a federal courtroom in Salt Lake City, just a few miles from the suburban basement where authorities say he and a friend pressed tens of thousands of fentanyl-laced fake oxycodone pills that were sold online.

Prosecutors said the drugs caused at least one fatal overdose and perhaps dozens more. It happened in 2016, as the nation’s opioid crisis spiraled into a fentanyl epidemic.

Shamo is charged with operating a criminal enterprise, selling drugs that caused a fatal overdose and other counts.

The affable, clean-cut former eBay worker has acknowledged selling drugs online and testified that he got messages from grateful customers who said their doctors had refused to prescribe any more painkillers. He also said people without insurance had to pay far more for the drugs in the legal marketplace.

“It seemed like a good idea, it was a win-win situation,” Shamo testified.

He said the operation began with reselling legitimately obtained prescription drugs, and as it grew his friends were deeply involved in key steps along the way.

Shamo said his roommate and “brainiac” friend Drew Crandall came up with the idea to press their own Xanax pills. Crandall later pleaded guilty to drug distribution and money laundering charges.

Another friend suggested they begin making fake oxycodone with fentanyl.

“At the time no one was screaming ‘stop.’ Everyone was benefiting,” Shamo testified. “It went from being a hobby to something where my eyes were a little too big. This wasn’t what I expected at all.”

Prosecutor Michael Gadd said during cross-examination that Shamo kept more than $1 million stacked in his dresser drawers and stashed nearly $500,000 more in his parents’ closet in Arizona.

Gadd also said Shamo took trips to California, Las Vegas and Puerto Rico with friends, bought bottle service at clubs and treated himself to designer clothes.

He pointed to a note he said Shamo wrote to himself on his computer on Jan. 1, 2016, saying he was going to “overachieve,” be “(expletive) rich” and a girl he liked would become “obsessed” with him.

Shamo explained the note by saying he had been trying to make himself feel better with a visualization exercise inspired by the self-help book “The Secret.”

Prosecutors have said Shamo bought fentanyl from China online and then mixed it with fillers and pressed it into pills with another friend, Jonathan Luke Paz, who has also pleaded guilty in the case.

The operation sold nearly a half-million pills, authorities have said.

The pills were sold through a dark-web marketplace store called Pharma-Master. The dark web is a second layer of the internet reached by a special browser and often used for illegal activity.

Shamo testified Tuesday that he had tried party drugs but grew up in a middle-class family who were members of The Church of Jesus Christ of Latter-day Saints, so he knew little about addiction before he went to jail more than two years ago.

“You don’t see the ripple that it has on all these people and their families,” he said while crying on the witness stand. “I got to see the struggle and it’s just brutal.”

Copyright 2019 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.

See what people are talking about at The Community Table!