Schools cannot bar members of the public from attending leadership team meetings, a judge ruled in a decision filed Thursday.

Manhattan Supreme Court Justice Peter Moulton rejected the city’s argument that the joint parent-educator teams play only an advisory role and so are not subject to open-meetings rules. Instead, he sided with advocates who filed a lawsuit arguing that the meetings should be public since the mandatory teams play an important role in schools.

“This is a victory for school parents, teachers, and students across our city, who all have the right to be involved in decisions about their schools,” Public Advocate Letitia James said in a statement. In January, James and the advocacy group Class Size Matters joined the lawsuit, which was filed by a retired Manhattan teacher who had been blocked from attending a leadership team meeting.

State law requires every city school to have a leadership team composed of the principal, parent association president, teachers union representative, and an equal number of elected parents and staff members. The teams are responsible for crafting an annual list of goals and strategies for their schools and must be consulted on major decisions, such as the hiring of new principals and the placement of other schools in their buildings.

In 2013, a Staten Island teacher sued the city after he was not allowed to attend a leadership meeting at his school. In that case, the judge agreed with the city that the teams are not “public bodies” subject to open-meetings rules. The city repeated that argument last year after Michael Thomas, the retired Manhattan teacher, brought a new suit.

In an April 16 ruling that was filed on Thursday, Justice Moulton said that leadership team “activities touch on the core functions of a public school.”

“Accordingly,” he wrote, “the [city’s] determination that SLT meetings are not subject to the Open Meetings Law is arbitrary and capricious and contrary to the law.”

A spokesman for the city law department said the agency is reviewing the decision with the education department in order to decide on a response. He wouldn’t say whether they would appeal, adding only that the agencies are likely to discuss the possibility.

Leonie Haimson, executive director of Class Size Matters, said an appeal would be “pointless and a waste of taxpayer dollars, given this slam-dunk decision.”

Haimson is a member of NYC KidsPAC, a political action committee that released a report Sunday giving Mayor Bill de Blasio’s administration an F grade for “transparency and accountability” and a D for “parent engagement and input.” Among its reasons, the group cited the city’s argument in the school leadership team case.

“The tendency of this administration to be non-transparent and ignore parental input is a theme that we see in many of their actions and policies,” Haimson said.