Indonesia is planning to outlaw sadomasochistic sex and homosexuality as part of a sweeping 'Family Resilience' bill that has been leaked online.

Under the proposed law, anyone 'suffering' from 'sexual deviations' including incest, sadomasochism and homosexuality would be required to report themselves to rehab facilities for treatment.

Those who fail to report themselves risk having their children taken away, either temporarily or permanently.

The bill would also outlaw surrogacy with a penalty of seven years in jail, and legally define the roles of a father and mother within the home.

Indonesia is planning to ban 'sexual deviations' including homosexuality, sadomasochistic sex and incest under a new 'Family Resilience' bill that has been leaked (file)

New laws would require fathers to protect their household from 'threats' including alcohol and pornography, while mothers would be legally obligated to 'take care of household-related matters.'

The bill has caused widespread outrage since being leaked, including from LGBT groups and those who accused politicians of interfering in private matters.

Politicians from four Indonesian parties are backing the bill as the world's most-populous Muslim-majority country shifts towards greater conservativism.

One of the bill's proponents, Ledia Hanifa of the opposition Prosperous Justice party, a conservative Islamic party, said in a statement posted on parliament's website that the proposed bill was intended to foster 'family-based development.'

According to the law, the family is defined as the smallest unit of society composed of married couples, married couples with children, and single parents.

The bill has been included on parliament's priority list for the 2020-2024 period, though proponents have yet to discuss it with the government's related ministries.

The law would also make surrogacy punishable with up to seven years in jail, and legally define men and women's roles within the home (file image)

Parties supporting President Joko Widodo currently control 74 per cent of seats in parliament so any bill would likely need government blessing to gain traction.

Supratman Andi Agtas, a member of parliament who heads a body overseeing the agenda of lawmakers, said a draft would be sent to the president before any deliberation between MPs and related ministries could start.

Fadjroel Rachman, a spokesman for the president, did not immediately respond to a request for comment.

Discussion about the bill has been trending on social media in Indonesia this week with many of the posts critical of the draft, which has also been condemned by rights groups.

'It's a very patriarchal bill and it will set back progress in gender equality and women's rights protection,' Usman Hamid of Amnesty International Indonesia told Reuters.

Tunggal Pawestri, a gender rights activist, said the bill would be harmful for anyone who did not have a marriage certificate.

'What about those who hold traditional beliefs who can't register their marriages?' she said. 'And also people who can't afford to register the marriages?'