Moncton court

William MacGillivray is scheduled to return to court on Feb. 24. (CBC)

A Moncton teacher who is facing several sex-related offences has been released from custody a second time on several conditions.

William MacGillivray, 41, of Harrison Trimble High School, had a bail hearing in provincial court on Friday.

He was arrested last weekend for allegedly breaching a court undertaking imposed the last time he was released that he report any change of address to police.

A second alleged victim had also come forward, resulting in a sexual exploitation charge dating back to 2010-11, RCMP said.

MacGillivray, who is also a drama instructor at the school, was previously charged with sexual exploitation, child luring, sexual assault and obstruction involving a girl under the age of 18 last year, while he was in a position of trust.

On Friday, Judge Pierre Arsenault ordered MacGillivray not to leave the Greater Moncton area and to install a landline in his residence.

MacGillivray listened attentively from the prisoner's box as his parents, who came from Miramichi to show support, looked on.

There is a publication ban on the evidence presented during the bail hearing.

Other conditions, imposed on Dec. 20, remain in effect. He must not be alone with girls under the age of 18 unless with an adult, not have any contact with the initial complainant or her family, and not possess a device to access the Internet unless it's at work.

MacGillivray must also report weekly to police and submit to searches by police without a warrant.

He is scheduled to return to court on Feb. 24.