Making all pupils take part in religious education classes could see the Welsh Government taken to court for breaching human rights, a legal expert has warned.
Parents' right to withdraw their children from religion lessons will be removed under Wales' new curriculum.
But Sir Malcolm Evans said this could lead to parents taking legal action.
The Welsh Government insisted the curriculum would not breach human rights.
Currently parents are able to request their children do not take part in sex and religious education, under an opt-out arrangement.
But under the new curriculum, set to be rolled out in schools from September 2022, the lessons will be compulsory, regardless of parental objections.
Under the changes, Wales will become the first part of the UK to remove the opt-out for religious education.
Ministers have argued making the subjects mandatory ensures all children have access to important information and that it is consistent with the status of other subjects.
But Sir Malcolm, a member of the Commission on Religious Education and Professor of Law at Bristol University, said removing the opt-out option for religious classes could breach human rights.
Under the European Convention on Human Rights parents have a right to have their children educated in accordance with their religious or philosophical convictions, which also includes non-religious belief.
Sir Malcolm said unless the Welsh Government could be "absolutely sure" the lessons were "sufficiently inclusive, plural, critical and objective" they would be open to legal challenges.
He said he agreed with the principle of delivering a broad education about different religious and faith traditions and non-faith traditions too, but problems were likely in practice.
"In my view having an opt-out is very much a safety valve," he said.
"It is a useful and important safety valve to ensure those parents and children who genuinely find it impossible to reconcile their beliefs with the content of an education of that nature still have the right to be able to exempt themselves from those classes.
"For that is, in my view, what human rights law says they are entitled to."
Humanists UK are also opposed to scrapping the opt-out because they fear faith schools will not provide a sufficiently broad approach to religious education.
"We are extremely concerned that, in state-funded faith schools, where teachers may instruct children from a certain religious perspective, this will be practically impossible," Wales Humanists co-ordinator Kathy Riddick said.
"The proposed new law seriously risks exposing pupils to unlawful indoctrination."
She urged the Welsh Government to "seriously reconsider the decision" to remove the parental right to withdraw pupils from religious education.
Under the new curriculum Religious Education will be renamed Religion, Values and Ethics.
In response to the concerns, the Welsh Government said the proposed legislative framework and guidance would be compatible with the rights protected by the Human Rights Act 1998.
"The Welsh Government has been clear that its policy in this area will require careful and sensitive handling prior to its implementation in September 2022," a spokeswoman said.