Thirty-two surrogate mothers charged with human trafficking in Cambodia for carrying babies for Chinese clients have been released after agreeing to keep the children, officials say.

The women were arrested in June in a raid as part of a crackdown on the country's commercial surrogacy trade.

Surrogacy was banned in Cambodia in 2016, a year after neighbouring Thailand imposed limits on the service.

Demand has risen in recent years since China's easing of its one-child policy.

A further five people, including a Chinese national, have been arrested and charged with human trafficking in connection with the case.

The release of the Cambodian surrogate mothers this week was agreed on "humanitarian grounds", a police official working with the National Committee for Counter Trafficking (NCCT) said.

The official, who asked not to be named, said that while the women had committed a crime, their babies were innocent, and for that reason the NCCT had requested their freedom on condition.

"They have agreed not to sell the babies and will raise them," he confirmed, stating that if the women break the agreement they could face human trafficking charges, which could result in up to 15 years in prison, AFP news agency reports.

In contrast, acting as an intermediary between an adoptive parent and a pregnant woman is punishable by up to six months in prison.

The women were released from a police hospital. It is not clear if they are genetically related to the babies they carry or whether they had agreed to act as gestational surrogates only (by carrying another couple's fertilised embryo).

Cambodia's Secretary of State for the Interior Ministry, Chou Bun Eng, told the BBC in a recent interview that the government rejects the idea that any embryo carried by a mother is not "her own".

"The woman takes care of them and feeds them for more than nine months before the embryo becomes human, so how can you give the children to someone else?" she said.

She added that surrogacy is now seen as a form of human trafficking in Cambodia because the children, who she said were the victims, are sold as "goods".

Commercial surrogacy has grown in South East Asia in recent years, prompting some countries to take action.

In 2014, a surrogate baby scandal erupted in Thailand after a boy with Down's syndrome - known as Baby Gammy - was abandoned by the Australian couple who had commissioned a Thai surrogate mother to carry him.

The following year, Thailand imposed a ban on foreigners seeking Thai surrogate mothers following a string of scandals in the industry.

This led to an increase in commercial surrogacy in neighbouring countries such as Cambodia, which then moved swiftly to impose a total ban.

But the practice has continued to flourish in other places where it is not regulated, such as Laos.

Last year, Australian nurse Tammy Davis-Charles was jailed for 18 months in Cambodia for providing commercial surrogacy services.

Besides commercial surrogacy, Cambodia has also banned organ trafficking and the export of breast milk.

Other countries that have imposed a ban on commercial surrogacy include India, New Zealand, Canada, Denmark and the UK.