LOS ANGELES — A Massachusetts college student who was named his high school’s valedictorian for his savvy tech skills hacked into unsuspecting investors’ personal cellphones, email and social media accounts to steal at least $2 million in digital currency like Bitcoin, according to documents provided by California prosecutors Wednesday.

Joel Ortiz was taken into custody July 12 at Los Angeles International Airport ahead of a flight to Boston, according to prosecutors. The 20-year-old faces more than two dozen charges including grand theft, identity theft and computer hacking, court documents show. He’s held on $1 million bail.

The Santa Clara County, California, public defender’s office, which is representing Ortiz, declined comment. A number listed for his home in Boston was disconnected.

The elaborate scheme involved taking over victims’ phones, allowing him to reset passwords and access online accounts containing electronic assets in the form of Bitcoin, Coinbase, Bittrex and Binance, the criminal complaint said.

In one case Ortiz allegedly walked into an AT&T store and impersonated a victim in order to get a new SIM card, which gave him control of the victim’s phone. He obtained access to the victim’s “financial and personal identifying information, tax returns, private passwords” and siphoned $10,000 from a cryptocurrency account, according to police report.

In several instances Ortiz allegedly impersonated victims over text messages and convinced friends and family members to “loan” him digital funds, court documents said.

At one point Ortiz allegedly stole $10,000 from a California resident, and then tried to get more, calling the victim’s wife and sending a text to the victim’s daughter that said “TELL YOUR DAD TO GIVE US BITCOIN,” the documents said.

Court documents identify more than 20 victims who live in California, and prosecutors say they know of additional victims outside of the state.

Ortiz enrolled at the University of Massachusetts Boston and studies information technology, said school spokesman DeWayne Lehman.

Ortiz was the 2016 valedictorian of Another Course to College, a small public college preparatory school in Boston, and was honored alongside other top students across the city at a luncheon that year with Democratic Mayor Marty Walsh and other officials at a downtown hotel.

At his school, Ortiz was the lead robot software programmer on its robotics team, taught other students the basics of software coding and “led efforts to teach computer science,” according to a Boston Public Schools’ press release touting the students’ accomplishments.

The school system said Ortiz “loves science and technology,” is fluent in Spanish and speaks conversational Chinese.

Boston Public Schools spokesman Daniel O’Brien declined to comment.