Fueled by an addiction to prescription painkillers, an FBI agent abused heroin from his own drug investigations and in the process botched dozens of cases involving suspected drug traffickers in multiple states, according to details that emerged Friday.

Matthew Lowry, formerly a special agent with the agency's Washington field office, tampered with hundreds of grams of heroin seized during drug investigations in 2013 and 2014, keeping it in his car for weeks or months, and periodically using it, according to charging documents filed in federal court in Washington, D.C., on Friday.

Lowry will plead guilty to 64 charges of obstruction of justice, heroin possession and conversion of property, attorney Robert Bonsib said. Lowry will face at least seven years in prison, prosecutors say.

The accusations against Lowry, 33, caused federal prosecutors to dismiss charges against at least 28 defendants in drug cases and notify 150 more that Lowry had participated in investigations targeting them, according to charging documents.

In one case, charges were dropped against 14 defendants suspected to be involved with a large-scale drug-trafficking organization that was the subject of a major FBI investigation in California and the District. The investigation included court-ordered wiretaps, physical surveillance and numerous controlled drug buys, time-consuming and costly investigative techniques.

Charging documents say Lowry took drugs that had been processed as evidence, remove heroin from evidence bags, and then add a cutting agent to account for the missing weight. He used a dietary supplement or a laxative as cutting agents, according to the documents.

Lowry also took heroin he got during controlled buys as part of FBI investigations, according to the documents.

Bonsib said in a statement that in each of 20 incidents involving evidence tampering, Lowry removed small amounts of heroin from evidence packages to self-medicate a long-standing health issue known as ulcerative colitis.

One of Lowry's doctors had prescribed him powerful pain medications without warning him of how addictive they were, Bonsib said. When his doctor left the practice without notice, Lowry tried to kick the addiction but it was "overpowering" and the pain from his medical condition was "unbearable," Bonsib said.

"Mr. Lowry recognizes the importance of taking full responsibility for each of his acts and he also recognizes the need to account to the public for his misconduct," Bonsib said.

Bonsib said Lowry is "devastated by the consequences of his conduct, particularly as it has affected the drug investigations that he, his fellow law enforcement officers, and prosecutors had spent so much time developing and pursing."

"The fact that his conduct has damaged the ability of some of those investigations to be successfully prosecuted is contrary to everything he trained himself for and believes in," he said.

Bonsib said the investigation into Lowry began after he was found unconscious in his unmarked FBI vehicle on Sept. 29 after overdosing on heroin.

A spokesman with the FBI's Washington field office declined to comment.

Bonsib called that night in September a "turning point," and said Lowry immediately tried to right his wrongs, meeting with prosecutors and investigators to help investigate his conduct. He has also sought treatment for addiction. Lowry is married and has a 13-month-old son.

The investigation into Lowry was investigated by the Department of Justice's Office of the Inspector General with assistance from the FBI. It is being prosecuted by federal attorneys in Pennsylvania after prosecutors in the District were recused from the case.