George Michael has been given an eight-week sentence for crashing his car while under the influence of cannabis.
He was also fined £1,250 at Highbury Corner Magistrates Court in London and given a five-year driving ban.
The 47-year-old singer was arrested in July in Hampstead, north London after driving his Range Rover into a branch of photographic store Snappy Snaps.
Last month he pleaded guilty to driving under the influence of drugs and possessing cannabis.
The singer was told then that his offences were "a serious matter" and that he could face imprisonment.
Michael is expected to serve four weeks in prison.
The pop star was greeted by a horde of photographers as he arrived at court earlier.
In 2007 he admitted another charge of driving while unfit through use of drugs at Brent Magistrates Court in London.
Michael was found slumped at the wheel of his car in the early hours of 4 July having crashed it into the store frontage.
He was arrested and taken to Hampstead police station, where he was found to be carrying cannabis cigarettes.
Michael shot to fame as half of pop duo Wham! before embarking on a successful career as a solo artist.
The singer - whose real name is Georgios Panayiotou - has made no secret of his long-time use of cannabis.
The BBC's Lizo Mzimba was in court and said Michael had "gasped" when his sentence was passed down.
Earlier his barrister said the singer was trying to get his life back on track and had started writing new material.
"For the first time in many years he has started writing again," said Mukul Chawla QC. "His creativity, so long hampered by his drug dependence, is re-emerging."
District Judge John Perkins told the singer he had taken a "dangerous and unpredictable mix" of prescription drugs and cannabis.
"I accept entirely that you have shown remorse for the offence, that you are ashamed of it, that you admitted it," he added.
"With regret," however, he said he had no alternative in this case but to give him a custodial sentence.
"It does not appear that you took proper steps to deal with what is clearly an addiction to cannabis," he told the singer.