MILWAUKEE — A British cybersecurity researcher credited with stopping a worldwide computer virus has pleaded guilty to developing malware to steal banking information.

Federal prosecutors in Wisconsin and Marcus Hutchins’ attorneys said in a joint court filing Friday that the 24-year-old agreed to plead guilty to developing malware called Kronos and conspiring to distribute it from 2012 to 2015. In exchange for his plea to those charges, prosecutors dismissed eight more.

“As you may be aware, I’ve pleaded guilty to two charges related to writing malware in the years prior to my career in security,” Hutchins said in a statement on his website. “I regret these actions and accept full responsibility for my mistakes. Having grown up, I’ve since been using the same skills that I misused several years ago for constructive purposes. I will continue to devote my time to keeping people safe from malware attacks.”

Hutchins faces up to 10 years in prison but could receive a more lenient sentence for accepting responsibility, the court filing said. Attorneys said Hutchins understands he could be deported.

Sentencing has not been scheduled.

Hutchins’ arrest in Las Vegas in August 2017, as he was about to board a flight to England, came as a shock; just months earlier he was hailed a hero for finding a “kill switch” to the WannaCry virus that crippled computers worldwide. At the time, he told The Associated Press in an interview that he didn’t consider himself a hero but that he was combating malware because “it’s the right thing to do.”

Prosecutors said Hutchins made incriminating statements during a two-hour interrogation, and later during a jailhouse phone call that Hutchins was told was being recorded, he told an unidentified person that he “used to write malware” years before.

“I knew it was always going to come back,” Hutchins said on the call, but that he didn’t “think it would be so soon.”

Prosecutors said in court filings that Hutchins sold the Kronos software to someone in Wisconsin and that he “personally delivered” the software to someone in California. The malware was designed “to intercept communications and collect personal information, including usernames, passwords, email addresses, and financial data” from computers, prosecutors said.

Kronos was “used to infect numerous computers around the world and steal banking information,” prosecutors said, without providing an exact number.

It’s unclear how much Hutchins profited from creating the malware, but in online chats the FBI intercepted in November 2014, Hutchins lamented he had only made $8,000 from five sales. Hutchins said he thought he would be making around $100,000 annually by selling Kronos with one of his conspirators, who is not named in the indictment.

Hutchins initially pleaded not guilty to all the charges and was scheduled to go on trial in July. While his case has been pending, prosecutors barred Hutchins from returning home. He has been living in California, working as a cybersecurity consultant.