A Bradford computer student risked his bright future when he made an empty boast that he was a drug dealer, a court heard.
Liaquat Ali, 20, spent the next few months in terror of being locked up after he jokingly offered to supply an undercover police officer with heroin and cocaine.
Ali, of Thryberg Street, Leeds Road, Barkerend, Bradford, thought the officer was selling dodgy jumpers when they met by chance in Barkerend.
He wanted to keep him where he was while he went to the cash point to get money to buy some.
Bradford Crown Court was told the officer was taking part in a police operation "test purchasing" drugs.
He caught Ali on camera telling him: "If you need any gear let me know".
Prosecutor Richard Smith said Ali had pleaded guilty to offering to supply heroin and cocaine.
He appeared in court on July 12 when sentence was adjourned for a probation report.
Mr Smith said officers equipped with cameras and audio recorders were on the streets of Bradford on March 5 to snare drug dealers.
The defendant, nicknamed Big Ali, wanted to buy some of the £5 "Lacoste" jumpers the officer purported to be selling.
Ali gave him his mobile number and offered to sell him £10 wraps of heroin and cocaine.
When he was arrested on March 22, he told police he was messing about and had never been a drug dealer.
His home was searched and no drugs, drug dealing equipment or cash was found.
Ali's barrister David Hall said he was of good character and had been "taking the Mickey".
Judge Penny Belcher said the offences would usually have attracted a custodial sentence but it was a very unusual case.
She believed Ali when he said he had never had anything to do with drug dealing.
Under the law he was still guilty of offering to supply drugs, although it was accepted he did not have any.
Judge Belcher told Ali: "You have a perfectly sensible and good future ahead of you."
She sentenced him to a 12-month community order that included 140 hours' unpaid work.
Comments: Our rules
We want our comments to be a lively and valuable part of our community - a place where readers can debate and engage with the most important local issues. The ability to comment on our stories is a privilege, not a right, however, and that privilege may be withdrawn if it is abused or misused.
Please report any comments that break our rules.
Read the rules hereComments are closed on this article