Does the National Council for Peace and Order's (NCPO) "return happiness" campaign hold a place for children who languish in Thailand's immigration detention centres?

"How long will I stay?" five-year-old Rayyan asked. "Will I live the rest of my life here?"

Yanaal, a Pakistani asylum seeker, didn't know what to tell his nephew. They were being held together in Suan Phlu immigration detention centre in Bangkok. Unsure of how to respond to the boy's shock and fear at being separated from his mother and sister, who were in a different cell, he gave Rayyan false assurances, promising he would be reunited with them within the week. It took six months.

The detention conditions faced by Yanaal and his nephew were bleak — small, overcrowded, and unsanitary cells, limited access to medical facilities, and minimum opportunity to leave the room. Fights frequently broke out among the prisoners. The guards would respond by slapping people and beating them with batons. Rayyan saw it all, day in and day out.

But this little boy's plight is not unique. Each year, Thailand arbitrarily detains thousands of children in dismal immigration facilities and police lock-ups across the country.

At any one time, approximately 100 of these children, primarily from countries that do not border Thailand, are being detained indefinitely, for months and even years. Thousands of other children from Thailand's neighbouring countries are summarily deported with their families after being held for days or weeks.

Locking up children can cause irrevocable damage to their development. A new report which I wrote, "Two Years with No Moon: Immigration Detention of Children in Thailand" explains the impact of detention on children in these facilities across Thailand. The conditions of confinement, inadequate nutrition, limited access to outdoor space and education deprive these children of their ability to develop fully.

Indefinite detention can also cause stark long-term effects on child mental health, including lasting psychological trauma.

I spoke to Veata, a 10-year-old from Cambodia, who was held in the Bangkok Immigration Detention Centre two years ago. She described, in detail, her fear of the immigration guards. "They would slap people in the face," she said. "I'm still scared now, I'm scared they're going to beat me."

Thailand is entitled to control immigration across its borders, but it should also still uphold children's rights as protected under international law. In 2013, the United Nations Committee on the Rights of the Child called on states to "completely cease the detention of children on the basis of their immigration status". Where detention persists, the committee has made it clear that the confinement should be minimal and only a measure taken as an absolute last resort.

Rather than placing children at unnecessary mental and physical risk, authorities should develop alternatives to detention, including supervised release or open centres. For example, unaccompanied children and children with families alike could be sent to shelters, maintaining family unity.

In the meantime, while children remain in detention facilities as the government expands alternatives, officials should make a concerted effort both to improve the conditions and to make sure the children are not locked up indefinitely.

Thai authorities should urgently enact legislation and adopt policies that are consistent with Thailand's international obligations as a party to the Convention on the Rights of the Child.

The NCPO has an opportunity to engage in real reform by securing the rights of migrant children. Releasing children from indefinite detention, and actively engaging in child-friendly immigration reforms that would end years of abuses would be a step forward in the right direction.

Alice Farmer is a children's rights researcher at Human Rights Watch and author of the report 'Two Years with No Moon: Immigration Detention of Children in Thailand'. Follow her on Twitter @ahsfarmer