PITTSFIELD -- A man facing drug charges and who represented himself in court was sentenced to a 2 1/2 year jail sentence on Thursday in Berkshire Superior Court.

The prosecutor said Lemarr S. Talley, 29, of Pittsfield, did "as good a job" defending himself "as any lawyer" he had dealt with.

Talley told the court he hopes to have a career in the legal profession in some form after serving his time.

Talley represented himself for many months in court appearances and through a number of motions he filed. Talley's stand-by counsel was Raymond J. Jacoub.

On Thursday, Talley pleaded guilty to a single count of possession of cocaine with the intent to distribute.

According to Second Assistant Berkshire District Attorney Robert W. Kinzer III, Talley was arrested on a warrant by members of the Berkshire County Drug Task Force on Aug. 22, 2011, during a traffic stop in Pittsfield. Police found nine bags of cocaine in Talley's sock and $1,205 in cash on his person, the prosecutor told the court.

Talley told the court on Thursday that what had happened to him was both a blessing and a curse. It afforded him the opportunity to change his life, helped him face substance abuse issues, and made him realize how many people depended on him, he said.

Kinzer asked that Talley be sentenced to 2 1/2 years to 2 1/2 years and a day in state prison. Talley asked that he be given an 18-month sentence at the Berkshire County House of Correction. The maximum sentence for the crime is 10 years in prison.

Judge Daniel A. Ford sentenced Talley to 2 1/2 years in jail. Talley already has 500 days credit for time served.

Talley agreed to forfeit the cash the police took from him during his arrest.