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.

A timeline of events in the battle over Ontario's sex-ed curriculum

September 2015: The Liberal government implements a “modernized” new sex-education curriculum. Social conservatives object to the inclusion of concepts such as gender identity, sexual orientation, and anal and oral sex.

May 8, 2018: The day before the official start of a provincial election campaign, Progressive Conservative Leader Doug Ford vows to scrap and replace the Liberals' sex-ed curriculum, accusing the party of turning schools into “social laboratories.”

July 11, 2018: Ford, whose Tories won the election, announces his government is repealing the Liberal sex-ed curriculum and replacing it with a temporary plan while consultations are conducted on what the new document should look like.

Aug. 22, 2018: The government announces a public consultation effort, opening a website and holding telephone town halls where people can offer feedback on the new curriculum.

Sept. 21, 2018: Hundreds of students across the province walk out of class to protest the repeal of the 2015 curriculum.

Dec. 31, 2018: The government concludes its public consultations.

Feb. 28, 2019: An Ontario court dismisses a legal challenge brought by a civil liberties group and major teacher's union, which said the government was discriminating against certain children by scrapping the 2015 curriculum.

March 16, 2019: The government says its new sex-ed curriculum will teach gender identity and consent and will also include teachings on abstinence and lessons on cannabis.

Aug. 21, 2019: The Tories reveal the new curriculum, largely maintaining what was in the Liberal document. Lessons on sexual orientation and gender identity remain mandatory, though at different times than those under the Liberal plan. Reference to masturbation, anal sex, consent and cyberbullying also remain in the curriculum.