A judge has withdrawn the conviction and guilty plea of a Dunedin man charged with sexually grooming a 14-year-old girl.

Photo: RNZ / Tim Brown

Evan Hedley Smith appeared in the Dunedin District Court this afternoon to be sentenced, but instead the judge told him the case must go to trial because it was apparent he still denied his offending.

Earlier this year the 63-year-old pleaded guilty to communicating with a 14-year-old girl online for several months and arranging a sexual encounter.

However, he was actually talking to an undercover police officer.

Judge Michael Crosbie told Mr Smith he was vacating both his conviction and plea as it was now apparent he still denied his offending.

Mr Smith met probation earlier this month, and told them he never thought he was communicating with a 14-year-old.

Judge Crosbie said the court could only sentence an offender if they "accept the essence of a charge".

"He maintains that he didn't believe he was communicating with a child and said he initially entered a not guilty plea because he didn't think he did anything wrong," the judge said.

"As the facts are he could never have known he was dealing with an undercover police officer because the sting was much too good."

Mr Smith was arrested last December after a three-month police operation that followed an investigation into suspicious approaches being made to school children around Dunedin.

At the time police thanked the public for coming forward with information which assisted the investigation.

"We know offending of this nature can cause a lot of concern so we're very thankful to all those who came forward with information, enabling us to help make our communities safer for all, especially our young people," police said.

The police first reported a concerning approach in early September last year.

That approach occurred in Dunedin's western hill suburb of Halfway Bush. A man in his vehicle approached a young girl on her way to primary school and was scared off by a member of the public.

The following week another girl was approached by a man in his vehicle, this time pleading for help to find a lost puppy. She refused.

Other reports followed, though the police never stated how Mr Smith was linked to the approaches or which approaches he was specifically believed to be linked to.

Judge Crosbie said the grooming charge would now have to proceed to trial.

The charge carries a maximum sentence of seven years' jail.

Mr Smith will appear in the Dunedin District Court again next month.