A Massachusetts middle school field trip to a local mosque has sparked controversy after a video surfaced showing some students participating in a Muslim prayer service during the visit.

Several parents complained to the school after the video, shot by a parent during the May 27 trip, was made public Wednesday. It shows a five sixth-grade boys kneeling, bowing their heads, and engaging in a prayer ritual at Islamic Society of Boston Community Center, the Boston Globe reported.

Wellesley School Superintendent Bella Wong apologized to parents in a letter Thursday and said that allowing the children to participate in the service was a mistake.

"It was not the intent for students to be able to participate in any of the religious practices," Wong told the Boston Globe. "The fact that any students were allowed to do so in this case was an error."

The video was released by Americans for Peace and Tolerance, a group that has been critical of the center in the past, after the group received it from a mother who recorded it while chaperoning the trip, the Globe reported.

"If a Catholic priest took school kids to a church and said, 'Let's teach them about Catholicism,' and the kids kneeled before altar, took wine and the host, the furor would be visible from outer space," the group's director, Dennis Hale, told the paper.

Bilal Kaleem, president of the Muslim American Society of Boston, which runs the center, said all the prayer was voluntary.

"Certainly in our tours we do not invite kids to take part, but if someone wants to come pray and take part, we shouldn't prevent them," Kaleem told the Globe. "It's more an issue with the school."

The trip was part of a social studies course, "Enduring Beliefs in the World Today," and also included trips to a synagogue, a gospel musical performance, and a meeting with Hindu religious leaders, Wong told the Globe.

In the future teachers will give "more clear guidance to students to better define what is allowed to fulfill the purpose of observation," she said in the letter to parents.

Click here to read more on this story from the Boston Globe.