MACHIAS, Maine — A Washington County District Court judge on Tuesday ordered a Harrington boy accused of a sex offense to attend school or an alternative education program pending his trial.

The ruling by Judge David Mitchell means that the 11-year-old, who made his initial court appearance Tuesday, may return to a classroom at Harrington Elementary School in which two witnesses to the alleged crime also are students. Mitchell instructed the boy to have no more than “incidental contact” with the other boys.

He would “leave it to education authorities” to ensure the witnesses are comfortable in the presence of the accused boy, said Mitchell.

The defendant has been tutored in recent weeks at the school district administration office, according to attorneys in the case.

The boy, who the Bangor Daily News is not naming because of his age and the fact that the charges against him remain pending, is accused of one count of gross sexual assault and one charge of assault. The alleged victim was a member of the same class, but his parents withdrew him and a sibling and placed him in private school.

Defense attorney Jeffrey Davidson, who represented the accused boy in court on Tuesday, said the youth had been tutored voluntarily in recent weeks because he may have been in danger from adults in the community of Harrington.

SAD 37 Superintendent Ronald Ramsay was noncommittal when informed of the developments.

“At this time I don’t know what will happen until I have a chance to talk to all the necessary people involved,” he stated in an email.

First Assistant District Attorney Paul Cavanaugh asked, as a condition of the defendant’s continued release, that he be prohibited from having contact with the witnesses as well as the alleged victim.

Prohibiting contact with the witnesses would preclude the boy from attending school, argued Davidson, and the youth still enjoys a “fundamental right” to an education.

Davidson referred to a “very public protest” in Harrington in January that was orchestrated by parents who were angry that the defendant had been allowed to continue to attend school after being charged. Those parents also met privately with Ramsay, who said later the boy was being allowed to continue to attend school because the alleged incident did not take place on school property.

There is no indication the defendant has attempted to intimidate the witnesses, said Davidson. Any contact among the three boys would be closely monitored by school staff, he said.

“There’s no reason to kick this 11-year-old boy out of school,” said Davidson, who also noted that some parents had unsuccessfully attempted to obtain a restraining order that would have prevented the boy from attending school and also filed notice that they would file a civil action in court.

Cavanaugh told Mitchell his request was routine. He also indicated the accused has had some contact with the witnesses but did not elaborate.

“This is just a simple, straightforward request,” he said.

The other boys involved in the case also have a right to an education, said Cavanaugh.

He said later his request was not intended to prohibit the accused boy from attending school.

“The difficulty with incidental contact is interpretation,” he said.

The accused boy, wearing a black-and-gray striped sweater and dark pants, answered questions from Mitchell at the outset of his court appearance. He denied the charges against him. His father and his grandparents, who are his legal guardians, were present.

The sex crime is alleged to have occurred in September 2013 in a home. However, Davidson told the court Tuesday that the event — a slumber party — at which the alleged crime occurred was in 2012, not 2013.

The defendant continued to associate with the victim and witnesses for 18 months afterward, according to Davidson.

The case tentatively was set to go to trial on April 8, but Mitchell and both attorneys agreed it was unlikely to proceed on that date.

The case prompted the resignation of a member of the School Administrative District 37 board as well as a review of school policies.

The defendant was summoned in late December on a felony charge of gross sexual assault, Stephen McCausland, Maine Department of Public Safety spokesman, confirmed earlier. The summons for a charge of assault — alleged to have taken place on the same date as the sex offense — was issued in January, Davidson indicated Tuesday.