After a week in the DeKalb County jail, rapper Young Thug was released Wednesday following the reinstatement of his bond.

The artist, whose legal name is Jeffery Lamar Williams, is charged in a DeKalb drug case stemming from a 2017 traffic stop in Brookhaven. He appeared in court for a Nov. 8 arraignment and failed a drug test, according to information presented in court Wednesday.

RELATED: Young Thug accused of having 4 types of drugs, tons of cash in DeKalb

He tested positive for marijuana and prescription drugs, and his bond was revoked. The rapper had been jailed until being released at 6:05 p.m. Wednesday.

His attorney, Brian Steel, petitioned a judge to give Young Thug another chance, citing his substance abuse issues and mental health concerns. Steel asked Judge Gregory Adams to release the rapper on the conditions he submit to frequent drug testing and undergo an outpatient drug program.

Young Thug, known for an unconventional delivery and collaborations with big names like Gucci Mane, told the judge he acknowledged his mistakes and wanted to get home to his children. The 27-year-old has six kids ages 4 to 11.

“I just want to be home with my family and be right,” he said. “This is real life ... I’ve got a son 10, 11 years old ... They look up to me.”

He said he hated the idea of his children seeing him in and out of jail. He wanted to set a good example.

“I’m sorry, and I won’t disobey again,” he told the judge.

Adams agreed to the release.

“Today,” he said, “you get the benefit” of the doubt.

Young Thug was indicted on multiple drug charges in connection with the September 2017 arrest on Clairmont Road. He is accused of possessing methamphetamine, hydrocodone and marijuana with the intent to distribute, as well as possession of amphetamine, a generic form of Xanax and codeine. He is also charged with possession of a firearm during the commission of a crime.

MORE: Atlanta rapper Young Thug indicted on multiple drug charges

Two others, Cedric Jones and rapper Sergio “Gunna” Kitchens, are also charged in the case.

In other news:

A judge will issue a ruling Wednesday morning.