Adam Ant may not be a Goody Two-shoes, but he doesn't belong in prison for pulling a gun on the patrons of a London pub.

The eccentric popster was, in the words of a British judge Wednesday, just a wee bit nutso when he showed up at the Prince of Whales alehouse in January wearing a cowboy getup and brandishing a fake gun when his fellow customers began snickering.

"If I looked at only the facts of what you did, a prison sentence would be justified," said Justice Jeremy Roberts of London's Old Bailey Criminal Court, before adding a big "but."

"But psychiatrists are agreed you were suffering a temporary episode of mental illness, which could have impaired the responsibility for what you did. Happily you are now recovered."

With that, Roberts decided to let the '80s glam rocker, otherwise known as Stuart Goddard, off with the relatively light sentence of one year's community service and supervised rehabilitation. Ant was also ordered to pay $780 to a local musician hit in the head by a car alternator Ant chucked through a window after leaving the establishment.

Ant's troubles trace back to January 12, when he made the mistake of showing up at the pub in north London's Kentish Town area clad in a cowboy hat and combat jacket. While that's relatively conservative clothing for a guy who dressed in puffy shirts during his "Highwayman" days, the patrons thought it kind of curious. Several began cracking jokes at Ant's expense, with one allegedly whistling the theme The Good, the Bad and the Ugly.

Ant exited the bar and tossed the aforementioned alternator at his tormentors (striking a fellow named Pavlos Contostavlos on the head, an injury that required three stitches). When several customers gave chase, Ant fended them off by flashing his weapon--an imitation starter pistol.

Police tracked Ant down in a taxi where he was spotted trying to stash the faux gun under the seat. He was subsequently arrested and committed to the psychiatric ward at London's Royal Free Hospital.

In rendering his decision, Justice Roberts sided with three psychiatrists who said Ant was in a "hyper-manic state" at the time because his girlfriend's jealous husband was harassing him, and he had been stalked by a deranged fan.

Therefore, Roberts reasoned, Ant wasn't right in the head at the time of his pub meltdown and was not responsible for his actions.

Ant, 48, had pleaded guilty in August to one charge of brawling, but prosecutors ended up dropping three other charges of possessing an imitation firearm, criminal damage and assault.

Ant has a long history of battling depression, with his first breakdown reportedly coming at the age of 21. In the early '90s, a bout of depression forced him to seek professional help, which resulted in a three-month stay in a clinic. And just last year, he suffered yet another nervous breakdown.

The now pudgy New Wave relic, whose hits include "Goody Two-Shoes," "Prince Charming" and "Strip," is currently receiving psychiatric treatment, his lawyer said.

Ant, who kept his eyes closed throughout most of the hearing, declined to talk to the press upon leaving the court.