A television comic has whispered an eleventh-hour guilty plea to a child-sex charge in front of a packed courtroom.



The plea bargain, struck between lawyers behind closed doors at the Auckland District Court, will ensure the man is spared a jail sentence.



The star, who has name suppression, faced a single count of unlawful sexual connection with a child, aged under 12.



After lengthy discussions between the Crown and the man's legal team, headed by barrister Marie Dyhrberg, the charge was replaced with the lesser offence of committing an indecent act against a child.



When asked how he wished to plead, the man looked down at the floor and after a long silence whispered "guilty".



The incident occurred in the hours following a 2009 television network Christmas party in central Auckland at the man's home. Alcohol was blamed.



Judge Phillipa Cunningham released the man on bail until he reappears for sentencing on May 26. She ordered a pre-sentence report.



Name suppression was today continued because "identification of [the man] would identify the child", the judge said.



His suppression would be reviewed at the time of sentencing but will almost certainly continue.



A large contingent of the celebrity's family was in court to witness his guilty plea.