Police seized cocaine worth £7000 after raiding a Blantyre address.
It led to Stuart Rae, 25, appearing at Hamilton Sheriff Court this week.
He admitted being concerned in the supply of the Class A drug at his home in Morven Avenue on September 1, 2020.
Co-accused Scott Traynor, 27, had his not guilty plea to the same charge accepted.
Aga Mathieson, prosecuting, said there was no one at home when police officers armed with a search warrant went to the house.
She told the court: "During the search they recovered 11 bags containing a white rock substance.
"The total weight was 317 grammes and forensic analysis confirmed it was cocaine.
"The accused was traced later and made no reply when charged."
Defence agent Andy Thomson said Rae was in the grip of a "horrendous" cocaine habit at the time.
The solicitor stated: "I'm pleased to report he has reversed that and is now completely drug-free.
"He has obtained full time employment and works seven days a week.
"There are no other court cases outstanding."
Sheriff John Speir deferred sentence until next month for background reports and an electronic tagging assessment.
Rae was allowed to remain on bail.
*Don't miss the latest headlines from around Lanarkshire. Sign up to our newsletters here.
And did you know Lanarkshire Live is on Facebook? Head on over and give us a like and share!