TORONTO -- Ontario's new sex education curriculum retains many elements of a previous Liberal government document that sparked controversy and that the Progressive Conservatives had slammed as ideological.

When in Opposition the Tories largely stayed away from naming any specific concepts in the curriculum that they had an issue with, but a protest movement led by social conservatives singled out gender identity, masturbation and references to anal intercourse as problematic.

In the new elementary curriculum, released Wednesday, sexual orientation will be a mandatory topic taught in Grade 5, earlier than in the Liberals' 2015 curriculum, which had it in Grade 6. Gender identity will be a mandatory topic in Grade 8 -- it was previously mandatory in Grade 6.

Both topics were previously mentioned in the curriculum document for Grade 3, though they were not mandatory lessons.

Students had to describe how visible and invisible differences make each person unique, and examples given for invisible differences were "learning abilities, skills and talents, personal or cultural values and beliefs, gender identity, sexual orientation, family background, personal preferences, allergies and sensitivities."

Those references to gender identity and sexual orientation have now been removed, and mental illness has been added.

Masturbation remains an optional teacher prompt in Grade 6, and anal sex continues to be first mentioned in Grade 7, in terms of delaying sexual activity until people are older.

Former Liberal premier Kathleen Wynne, who is gay, has said she had no doubt that homophobia motivated some of the protesters.

Premier Doug Ford and other Tories had said the Liberal curriculum was ideological and had promised during last year's election to repeal it and engage in a wider consultation with parents.

One of the most vocal opponents to the curriculum, Tanya Granic Allen, had vaulted the issue back into the spotlight when she ran for the Progressive Conservative leadership months prior to the election.

Granic Allen tweeted Wednesday that Ford's new curriculum is a betrayal.

"The radical Wynne sex-ed is still there - ALL OF IT. And gender identity is mentioned 40 times," she wrote. "Ford LIED to the parents."

The new curriculum also has a new focus on mental health, adds teaching on concussions and the risks of vaping, and expands on lessons on consent and cyberbullying.

There will also be an option for parents to have their children opt out of certain teaching blocks, which standardizes a process that was already in place across most of the province.