Three men, including two convicted felons, were indicted Wednesday in connection with the death of rapper-producer Mac Miller, who overdosed on counterfeit painkillers at his California home last year.

The trio — Stephen Walter, Cameron Pettit and Ryan Reavis — were charged with conspiring to distribute controlled substances resulting in death and distribution of fentanyl resulting in death, according to an indictment obtained by NBC News.

Both Reavis and Walter, who has also been charged with being a felon in possession of ammunition, have criminal histories involving drugs, the indictment says.

Miller, 26, was discovered unresponsive in his Los Angeles home in September 2018 after snorting counterfeit oxycontin pills laced with fentanyl, authorities say. His death was ruled an accidental overdose of cocaine, alcohol and fentanyl.

Pettit, 28, is suspected of selling Miller the counterfeit pills two days before he died. Prosecutors say Walter, 46, supplied the drugs to Pettit, while Reavis, 36, is accused of acting as Pettit's drug courier.

The three men each face potential life sentences without parole if convicted in the death of Miller, whose real name is Malcolm McCormick.

“These defendants allegedly continued to sell narcotics after Mr. McCormick’s death with full knowledge of the risks their products posed to human life," said Nick Hanna, U.S. attorney for the Central District of California.

The 12-page indictment says Pettit agreed to sell Miller 10 "blues" — a street term for oxycodone pills — in addition to cocaine and Xanax. But instead of providing Miller with genuine oxycodone, Pettit sold him counterfeit pills containing fentanyl, a synthetic opioid 50 times more potent than heroin, the indictment says.

Investigators recovered damning Instagram messages sent by Pettit in the aftermath of Miller's death, according to a previously filed criminal complaint.

"I think I should probably not post anything … just to be smart," Pettit allegedly said in one of the texts.

Asked in another text message how he was doing, Pettit, who has been charged with one count of distribution of a controlled substance, allegedly wrote: "I am not great ... Most likely I will die in jail."

Less than one month after Miller's death, Pettit agreed to supply Walter with another 10 "blues," and the pair continued engaging in drug sales up until Aug. 30, the indictment says.

Reavis was involved in drug trafficking through this past June and sent messages indicating that he was well aware people were overdosing from fake oxycodone pills, according to the indictment.

“People have been dying from fake blues left and right, you better believe law enforcement is using informants and undercover to buy them on the street do [sic] they can start putting ppl in prison for life for selling fake pills," the indictment says.

Ryan Reavis was arrested in connection with the death of rapper Mac Miller, who overdosed on fentanyl, alcohol and cocaine in 2018. Lake Havasu City Police Department

Pettit and Walter are scheduled to be arraigned on Oct. 10. It wasn't clear when Reavis, who was taken into custody in Arizona, will be arraigned.

Walter's criminal history includes convictions for possession of cocaine base for sale, possession with intent to distribute methamphetamine and unlawful possession of a firearm by a felon, the indictment says.

Reavis has convictions in three separate cases, including drug possession and assault.

Lawyers for the three men did not immediately return requests for comment.

In his tenure as U.S. attorney for the Central District of California, Hanna has made a point of prosecuting a variety of players in the supply chain of illegal narcotics. "We owe it to the victims and their families to aggressively target the drug dealers that cause these overdose deaths," he said last month.

Born in Pittsburgh, Miller reportedly taught himself how to play piano, bass, guitar and drums as a young child, before switching to rap in high school.

Miller, who spoke publicly about his struggles with addiction, skyrocketed to fame eight years ago with the debut of his mixtape, "K.I.D.S. (Kickin' Incredibly Dope S---)."

In the months leading up to his death, Miller was in the midst of a career resurgence with the debut of his fifth album, "Swimming." He was planning to go on tour in support of the album's release.