SAO PAULO — Brazil’s Supreme Court voted narrowly Wednesday to authorize state schools to promote specific religions.

Chief Justice Carmen Lucia made the deciding vote in favor of so-called confessional schools, at which teachers will be permitted to promote their religious beliefs during class. In non-confessional schools, teachers can discuss only the history and social impact of religion.

The 6-5 decision by Brazil’s top court also states that students cannot be compelled to attend religion classes and that they must have their parents’ permission to participate.

Brazil’s constitution says religion classes should be available for pupils between the ages of 9 and 14, but it doesn’t specify what should be taught.

Several private schools and universities in Brazil have links to the Roman Catholic Church and evangelical faiths.

The chief justice said lay control of schools will be protected since pupils can decide whether to attend religion classes or not.

“Religious liberty needs to be respected, but without imposing rules to the nation. But I don’t see a submission of the state in the norms being questioned,” she said.

Brazil’s Supreme Court made the decision after the Attorney General’s Office argued that a deal between Brazil and the Vatican allowing religion classes in public schools was unconstitutional.

Justice Luis Roberto Barroso, who voted against allowing religion classes in public schools, warned that the decision puts secular control of schools at risk.

“A religion cannot use public space to promote its faith. This would be a private appropriation of public space,” Barroso said.