Lee Ryan unleashed a foul-mouthed tirade against police and then urinated all over his cell after he was arrested for drink-driving.
But the Blue singer blamed his meltdown on the torrent of online abuse he received in the wake of his controversial appearance on Celebrity Big Brother.
He was handed a £3,325 fine and banned from the roads for two years for failing to provide a specimen and causing £120 of criminal damage. Fellow Blue members Duncan James, Simon Webbe and Antony Costa were in court to support their bandmate.
Ealing Magistrates' Court, in west London, heard the 30-year-old singer had been out partying to celebrate his best friend and bandmate Duncan's birthday on the night of his arrest.
Officers spotted Ryan swerving erratically at 5.30am on April 11 as he drove his female friend's Audi A3 on the Uxbridge Road in Ealing.
There was an empty bottle in a pocket by the driver's seat and he stank of alcohol and slurred his words as he got out of the driver's seat.
Majit Mahal, prosecuting, said: "Officers could immediately smell alcohol from Mr Ryan's breath and his eyes appeared glazed.
"Asked if he had consumed some alcohol that night, Mr Ryan said 'Yes, a few'.
"Officers then noticed that there was an empty bottle in the pocket of the driver's seat. When Mr Ryan exited the vehicle, he was obviously unsteady on his feet, his speech was slurred."
He was in such a "drunken state" that officers took him straight to the police station.
But he refused to take a breath test to see if he was over the limit and repeatedly swore at officers.
Mr Mahal said that when officers warned Ryan he would be prosecuted if he did not provide a specimen, he replied "f*** off".
The slurring star became aggressive to officers and was marched to a cell at Acton police station where he urinated and was sick all over the floor.
Mr Mahal said that when officers returned to the room where Ryan had been placed, they could see urine was leaking from the door into the hallway.
The star is said to have told officers: "I didn't realise there was a toilet here."
Asked by the officer "Do you do this at home?", he said "Yes I do, f*** off you c****".
In a police interview later that day, Ryan told officers he had drunk a vodka and tonic and a rum and Coke, but thought he was OK to drive.
He told officers he was on antidepressant medication and antibiotics, which he blamed for his state.
Mr Mahal said: "He believed his drink may have been spiked, because normally he would have been fine.
"Officers explained to Mr Ryan that his conduct towards officers had been abusive and he was challenged about the language he used.
"Mr Ryan said he had no memory of the conduct or the words he is alleged to have used."
Ryan's defence lawyers blamed the troubled star's outburst on the stress he has been under since he left the Celebrity Big Brother house earlier this year.
They said he had fallen victim to vicious online abuse on Twitter and had even received death threats.
Peter Ratliff told the court: "There can be no doubt that decision (to take part in Celebrity Big Brother) was a mistake.
"When he left the Big Brother house he felt that some of the print media had turned against him.
"He was subjected to visceral and unpleasant attacks in the media."
He said Ryan had received "140 pages of Twitter abuse - abuse that in another era would be unfathomable. He received death threats. He received abuse from members of the public."
He said Ryan was a "vulnerable individual who doesn't cope well with pressure".
The singer had been left "shattered" by the stinging criticism and abuse he has received from the press and public and that goes "some way in prompting this crash in his behaviour".
Mr Ratliff said on the night of the incident "he was abused by a female who called him an a***hole and asked him if he was that p***k from the telly.
"He was genuinely upset about that."
He said Ryan left the bar with his friend Maxine, and "stupidly said he was OK to drive" her car because she was too drunk.
He added: "To say he is remorseful is an understatement. He is disgusted at his behaviour."
Ryan had sought professional help from two doctors at the Priory hospital and a Harley Street clinic in the months just before the incident.
And he had checked into residential rehab clinic Capio Nightingale hospital in Marylebone, west London, afterwards.
Mr Ratliff said a driving ban would "make it hard for him because being on public transport will mean he is in a situation where the public may subject him to abuse".
Sentencing Ryan, chairwoman of the bench Alison Watson said: "This is a very serious offence and I think you do accept that."
Wearing a dark grey suit, white shirt and black tie, the singer nodded and looked contrite as he heard his sentence read out.
He was told his two-year driving ban would be cut to 18 months if he completes a drink-driving course.
In a statement released after the hearing, Ryan said the drink-fuelled incident was an "important lesson" and he thanked his bandmates for their support.
The statement said: "Lee respects the court's decision today and takes full responsibility for his actions.
"This has been an important lesson for Lee as he works towards a healthier and happier new chapter in his life.
"He thanks everyone for their support, particularly his bandmates in Blue, his management team and, most importantly, the fans that have supported him through this troublesome time."