MSPs have voted to pass the Bill which will see the end of Section 28, the law forbiding the promotion of homosexuality in schools.

The Ethical Standards in Public Life Bill contains a clause to repeal the 12 year old law.

The Scottish Executive has pledged to replace it with "guidelines" for teachers which will not be legally binding.

The second phase of the Bill, which applies a new code of conduct for councils and public bodies, was passed by 103 votes to 16, with five abstentions.

Opponents are funding a ballot on Section 28

It will now go back to be considered in further detail by the parliament's committees before it comes before MSPs again.

The Tories have warned that they will not back the bill while it contains the repeal of Section 28.

Deputy Conservative leader Annabel Goldie MSP said: "The executive's attempt in this bill to repeal Section 28 and replace it with unenforceable waffle is, frankly, unacceptable to the Scottish Conservatives and unacceptable to the majority of people in Scotland."

The Scottish National Party backed the executive, but signalled they wanted new guidelines on sex education anchored by statute.

Media campaign

SNP education spokeswoman Nicola Sturgeon said: "I think the SNP's suggestion, which we will table as an amendment to this bill at stage two, provides a solution.

"A real way forward towards repeal of a despicable piece of legislation."

The executive has come under fire from all sides over its handling of the reforms.

Wendy Alexander: Attacked "billboard negotiations"

A media campaign by transport millionaire Brian Souter against repeal came under attack from Communities Minister Wendy Alexander.

She said: "Billboard negotiations are no negotiations at all.

"A campaign which was very expensive to mount, but with a cheapness all of its own and now, next out of the till, is a privately funded opinion poll."

Mr Souter's Keep the Clause campaign is to pay for a public ballot on the issue next month.

Parental support

Some church leaders have also backed retention of the law.

However, a number of parents groups have this week publicly backed the Scrap the Section campaign.

They argue that the law is discriminatory and, in many cases, actually inhibits teachers.