It was a black-and-white photograph in a newspaper. It showed a small boy, locked in a caged bed in a residential institution. His hands clutched what appeared to be chicken wire containing him, and his expression was agonised. There would be no Lumos – the charity dedicated to closing child institutions and so-called orphanages – if there hadn’t first been this picture. I knew the immediate shameful impulse to turn away, to hide the page, not to look.

I could try to justify that impulse by saying that I was pregnant at the time, feeling vulnerable and hormonal. The sad truth remains that my instinctive reaction to that picture could stand as a metaphor for the attitude that has enabled the unjustifiable incarceration of 8 million children around this world to take place with little outrage or comment. Ashamed of that reflexive refusal to look, I forced myself to turn back to the picture and read the article.

It told of a nightmarish institution where children as young as six were caged most of the day and night. I ripped the article out, and the following day I began writing letters to everybody I could think of with influence in the matter.

These efforts led quickly to the establishment of Lumos, named for the spell I created in Harry Potter to bring light to some dark and frightening places. Part of our work in Lumos is to shed light on the lives of those millions of children separated from their families for reasons of poverty, disability and discrimination.

The shocking truth is that the vast majority of these children have parents that could care for them. They are not orphans. Most are placed in institutions by families who are too poor to provide for them, or because of a lack of local education and health facilities, especially for children with special needs. The minority who do not have parents, or for whom staying at home is not in their best interests, are often placed in institutions because there is no alternative.

The idea of any child being taken from their family and locked away, all too often in atrocious conditions, is particularly poignant at this time of year. For children in institutions, life too often resembles the darkest of Grimms’ fairytales. Georgette Mulheir, CEO of Lumos, tells how one Christmas she took sweets to the 270 children in a particular institution. What she discovered there was nightmarish. It was minus 25 outside, the heating was broken, children lay shivering in their beds, dressed in all their clothes, wrapped in threadbare blankets.

Again and again, when I quote the statistics to people who are not familiar with the field – 8 million children separated from their families worldwide – they are aghast and disbelieving. “How could that happen,” they ask, “without the whole world knowing?” The answer is really quite simple: who is easier to silence than a child? Especially a child with mental or physical disabilities, who is taken away from a family that has been convinced that it is for the best, or whose only alternative is watching that child starve.

There is now a wealth of scientific proof that institutions cause children measurable and sometimes irreparable harm. Institutionalised children are far less likely to be educated and to be physically or mentally well. Malnutrition is all too common. They are many more times likely to be abused or trafficked. The effects on infants are particularly chronic, with many failing to thrive, or dying.

The impact of not having the love and attention of a dedicated carer is profound. It can cause stunting, developmental delays and psychological trauma. I have seen babies who have learned not to cry because nobody comes. I have met children so desperate for affection that they will crawl into any stranger’s lap.

Damage is done very early, and it is lasting. Cut off from society, institutionalised children return to the world with their chances of a happy, healthy life greatly impaired, often unable to find employment, excluded from the community and more likely to enter into a lifetime of poverty and dependency.

A crucial point is that these dire effects apply to children from all kinds of institutions, including those that are well resourced. The solution is not pretty murals, or comfier beds, or teddy bears. The solution is no institutions.

The good news is that this is an entirely solvable problem. Based on the successes already achieved in several countries, Lumos estimates that the institutionalisation of children can be eradicated globally by 2050 – in our lifetime.

Where there is investment in inclusive education and health, where vulnerable families receive support for poverty, employment and social and medical problems; where there are fostering, adoption or other family-based care alternatives for children who cannot be with their parents; and where the culture of institutionalisation is replaced by one that prioritises keeping families together, children can thrive within their own families and communities.

International donors play a vital role in this regard. The issues they choose to fund, and the principles they promote, greatly influence what support is available to children and families.

Ending the practice of keeping children in institutions isn’t just a moral imperative: it makes excellent economic sense. It is far more cost-effective to support a child in a family than in an institution – and this also reduces long-term costs, since these children are far less likely to become dependent in adulthood. We know our model works. Since Lumos began working in Moldova in 2007, there has been a 70% reduction in the number of children in institutions nationally, despite chronic political instability and Moldova’s standing as the poorest country in Europe.

In the Czech Republic, while the numbers of children being admitted into institutions has dropped by 16% nationally in the past year, in Lumos’s demonstration area they have achieved a 75% fall in admissions. It is eminently possible that by 2020 there will be no more children in institutions in the Czech Republic.

Since Lumos began working in Bulgaria, the number of children in institutions has reduced by 54%. New admissions to institutions in Bulgaria have fallen by 34%, and the number of foster carers has increased by 440%, from 357 to more than 1600, providing the much-needed family environments for children who would otherwise be in institutions.

This is a critical time for getting children out of institutions. The commitments made by the EU, the US and the Global Alliance for Children – a grouping of public and private aid donors, and NGOs, of which Lumos is a key member – have set an important precedent for other donors. There is now a critical mass of expertise and evidence on which we can all build.

Many millions of people around the world want to see an end to the harmful and unnecessary practice of institutionalisation. Everyone has a role to play in that regard, which is precisely the idea behind the social media campaign #letstalklumos launched last month. Keeping this issue alive and creating awareness is a vital part of changing the future for these children.

I recently committed to becoming president of Lumos for life. It is my dream that, within my lifetime, the very concept of taking a child away from its family and locking it away will seem to belong to a cruel, fictional world.

• JK Rowling recently launched the awareness campaign #Letstalklumos (wearelumos.org/letstalklumos)

© JK Rowling, founder and president of Lumos