The New Zealand government wants to put a stop to so-called conversion therapy.
Legislation was introduced to the New Zealand parliament on Friday that would bring in prison terms for those found guilty of the practice.
Under the proposed measures, practices intended to change a person's sexual orientation, gender identity or gender expression that cause "serious harm" would carry a prison sentence of up to five years.
Practicing conversion therapy on someone below the age of 18, or a person with diminished decision-making capacities would carry a three-year prison term.
Justice Minister Kris Faafoi said in a statement that "conversion practices have no place in modern New Zealand."
"They are based on the false belief that any person's sexual orientation, gender identity, or gender expression is broken and in need of fixing," he said.
"Health professionals, religious leaders and human rights advocates here and overseas have spoken out against these practices as harmful and having the potential to perpetuate prejudice, discrimination and abuse towards members of rainbow communities."
Mr Faafoi said the legislation was not concerned with general religious expressions around sexuality or gender.
"The Bill's definition of conversion practice has been carefully designed to ensure health practitioners providing health services will not be captured; nor will people providing legitimate counselling, support and advice," he added.
"General expressions of religious beliefs or principles about sexuality and gender will also not be captured."
New Zealand's Prime Minister Jacinda Ardern last year vowed to ban gay conversion therapy in the country if she was re-elected.
Attempts to ban gay conversion therapy in the UK and elsewhere have been met by concerns from religious communities that ordinary practices like prayer will be criminalised.
The Christian Institute has said it will take legal action if legitimate expressions of religious belief are outlawed under such a ban.
The UK Evangelical Alliance has warned against a broad definition if the UK government moves ahead with its plans.