A man has been ordered to register as a sex offender after admitting abusing three young boys over a 17-year period.
Anthony Whatley pleaded guilty to two counts of indecent assault and four of indecency with a child when he appeared at Swindon crown court.
The 49-year-old from Melksham had been due to face trial by judge and jury on a series of sex offences including rape and attempted rape.
But before a jury could be sworn in on Monday morning Whatley pleaded guilty to six matters, and prosecutors said they would not proceed with the more serious charges.
The first offence took place between the start of 1976 and the end of 1978 when he indecently assaulted a boy under 16.
Between the start of 1988 and the end of 1990 he committed one indecent assault and three counts of indecency with a child under 14.
The final offence, on another boy under 14, took place between the start of 1989 and a date in early October 1993.
Whatley, of Milton Avenue, Melksham, had denied all the matters when he appeared before the court last year.
The case was adjourned to Thursday, May 16 for a pre-sentence report and Whatley was released on bail on condition he does not have contact with the complainants or anyone under 16 unless supervised by a person over the age of 21.
He must also live at home, not obtain means of travel abroad, report to the police station three times a week and register as a sex offender pending sentence.