A Moncton high school teacher accused of having inappropriate relationships with two teenage girls has been granted bail.

William MacGillivray was freed from sheriff’s custody after a bail hearing at Moncton provincial court on Friday.

The 41-year-old Moncton man is a teacher at Harrison Trimble High School, where he was also a drama instructor.

In December, MacGillivray was charged with child luring, sexual exploitation and sexual assault.

The incidents are alleged to have occurred between March 1 and November 30 and involve a girl under the age of 18.

MacGillivray is alleged to have committed the offences while in a position of trust.

Police say MacGillivray is facing new charges after a second alleged victim came forward.

He was arrested last weekend and charged with sexual exploitation in connection with alleged incidents from 2010 to 2011, and breaching a court undertaking by not reporting a change of address to police.

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

He has also been ordered not to be alone with girls under the age of 18 unless with an adult, and not possess a device to access the Internet unless it's for work, among other conditions.

He is due back in court on Feb. 24.