Media playback is unsupported on your device Media caption Baby Gammy is now settled in a provincial Thai town, as Jonathan Head reports

Thailand has passed a law banning foreigners from paying Thai women to be surrogates, after two high-profile cases sparked debate last year.

The legislation also bans the use of agents, or any promotion of women willing to carry babies for others.

Last year the case of a little boy born with Down's syndrome put Thailand's surrogacy industry in the spotlight.

His Thai surrogate mother said his Australian parents abandoned the boy but took his healthy twin sister home.

Under the new law, only married Thai couples or couples with one Thai partner who have been married at least three years can seek surrogacy, and commercial surrogacy is banned.

Anyone caught hiring a surrogate mother faces a maximum jail sentence of 10 years.

Agents touting surrogate mothers would also face imprisonment if caught.

'Baby factory'

The case of the Australian boy - named "baby Gammy" - made headlines around the world after his Australian parents took his healthy twin sister home and left him in Thailand.

He remained with surrogate mother Pattaramon Chanbua, 21, and was later granted Australian citizenship so he can have access to medical care.

Concern about the industry worsened when a Japanese man was found to have fathered more than a dozen babies by different Thai surrogates, a case later dubbed "the baby factory".

Analysis: Jonathan Head, South Asia correspondent

It has been nearly five years since Thailand began drafting a law on commercial surrogacy. The bill had been stalled by successive political crises, but the plight of Baby Gammy, and then the shocking revelation of Mitsutoki Shigeta's 16 or more surrogate babies, spurred the Thai government into action. They were shamed by the moniker 'Womb of Asia' that Thailand had earned from its booming surrogate business.

The yearning of childless couples for babies will now probably move on to less regulated countries. But will surrogacy end in Thailand? The money to be made is so tempting for poor families that the business may still survive as an underground, illegal one, with all the dangers to the women of exploitation and poor health facilities.

Law enforcement in Thailand is famously lax. And there is still a debate over whether legitimate surrogates should be paid something for the time, effort and health risks they take in carrying some else's baby.

Tackling 'wombs for rent'

Q&A: Surrogate babies

Commercial surrogacy was supposedly banned by Thailand's Medical Council in 1997.

Nevertheless a booming surrogacy industry has sprung up, attracting many foreigners.

According to Families Through Surrogacy, an international non-profit surrogacy organisation, the UK has the highest number of people in Europe seeking surrogacy overseas and the second-highest globally after Australia.

The organisation estimates that hundreds of UK residents travelled abroad in 2014 to Thailand and the US - the two most common surrogacy destinations.

Australia's Department of Foreign Affairs and Trade (Dfat) said last year that up to 150 Australian couples were expecting a child by a Thai surrogate mother in 2015.

Families Through Surrogacy estimates that parents travelling to Thailand pay approximately 1.7 million Thai Baht ($52,000; £34,000), comparable to estimated costs in the US, Mexico and India.

Lawmaker Wanlop Tangkananurak said the law - which was first read in parliament in November - aimed to prevent Thailand from being "the womb of the world".