Federal prosecutors arrested and charged a man in connection with the death of rapper Mac Miller, who was found dead in September 2018 of an accidental overdose of fentanyl, alcohol and cocaine, according to a federal criminal complaint unsealed Wednesday.

Drug Enforcement Administration agents and officers with the Los Angeles Police Department arrested Cameron James Pettit on federal charges for allegedly selling drugs approximately two days before Miller's fatal drug overdose.

Pettit allegedly sold the rapper counterfeit oxycodone pills that contained fentanyl, according to the U.S. Attorney's Office.

According to the toxicology report, Miller was found unresponsive, kneeling on his bed in a "praying position" at his Los Angeles-area home Sept. 7 by his assistant, who called 911 and was instructed to perform CPR until paramedics arrived. Miller was pronounced dead at the scene at 11:51 a.m. PDT.

Miller texted Pettit days before his death asking for drugs, and Pettit agreed to bring the rapper oxycodone pills, cocaine and Xanax, according to the 42-page criminal complaint filed in the Central District of California.

The criminal complaint alleges Miller snorted the counterfeit oxycodone pills supplied by Pettit shortly before his death.

The documents reveal messages Pettit allegedly sent after Miller's death, telling a friend, "Most likely I will die in jail" and "I'm gonna get off the grid."

If convicted of the drug trafficking charge, Pettit could face up to 20 years in federal prison. Pettit was charged only with providing the drugs, not with having a direct role in Miller’s death.

Miller, born Malcolm James McCormick and raised in Pittsburgh, rose to fame with his mixtape "Best Day Ever" in 2011, landing on the Billboard Hot 100 chart with the single "Donald Trump."

The rapper and former boyfriend of Ariana Grande struggled with substance abuse, revealing his ups and downs with drug addiction in interviews and song lyrics.

He rapped about his struggles with addiction on his 2014 mixtape "Faces," speaking about that time in his life to Vulture in an interview published days before his death. “I used to rap super openly about really dark (expletive), because that’s what I was experiencing at the time," he said. "That’s fine, that’s good, that’s life. It should be all the emotions."

He was remembered at a public vigil in Pittsburgh, as well as a tribute show in Los Angeles.

Coroner:Rapper Mac Miller died from accidental overdose on fentanyl, cocaine, alcohol

More:Mac Miller dead from a suspected overdose at 26

Contributing: The Associated Press