The two teenagers were living on their own. Their mother had been jailed after the rioting in London last summer. Her sons, aged 16 and 17, were living in the family home without an adult. No one had thought to inform the authorities.

"They were in a pretty poor state," says Nikki Bradley, who runs the Family Interventions service at Tower Hamlets, east London. "They only had one pair of trainers between them so they used to take turns to wear them, going to college in them on alternate days."

When a woman is sent to prison it is not just she who is punished. The children of prisoners – who have done no wrong, whatever crime their mother may have committed – are punished too. But little account is generally taken of their needs.

According to the most recent figures around 200,000 children each year suffer from the loss of a parent in prison - far more than are separated through divorce. When mothers are jailed only nine per cent have fathers who step forward to take care of them. Most others are cared for by the woman’s mother or another female relative. But 17,000 children a year are left effectively parentless. They are the hidden victims of a system in which the number of women jailed has doubled in the last 15 years.

"Prison is needlessly cruel in the harm it does to children," says Juliet Lyon, director of the Prison Reform Trust. The problems begin almost from birth. In the first six to nine months of life a mother and baby bond in a process which psychologists call attachment. "If the quality of that relationship is impaired it can damage the way a child develops, emotionally and socially, and impair its ability to form normal relationships throughout its life," says Tessa Baradon, head of the Parent Infant Project at the Anna Freud psychotherapeutic centre who devised the parenting course currently used in a number of women's prisons.

The extent of the disruption is significant. For eight out of ten children when their mother goes to prison it is the first time they have been separated from her for more than a day or so. Half of the babies who are taken into care when their mothers go to prison are moved from one carer to another, two, three or even four times.

Babies who suffer poor attachment with their mothers are more likely to be involved in crime as adolescents, according to a report by the Children's Commissioner for England. There is also an increased likelihood of the child having learning difficulties or developing personality problems or other psychiatric disorders.

The Prison Service attempts to address this through the mother and baby units it runs in eight of its 13 women's prisons. "We support the mothers in developing their confidence as mothers and their attachment with their babies and older children," says Karen Moorcroft of the charity Action for Children which runs the units inside Styal prison in Cheshire and New Hall in West Yorkshire.

Several prisons have run a New Beginnings programme devised by Ms Baradon , though funding for the work was axed by the Ministry of Justice last year. "If you work with the baby in parallel with the mother," she explains, "you can actually influence the baby's development directly in such a way that it helps the mother. "

The aim is to make the mothers more aware of the needs of the baby as separate from their own. It promotes what the psychotherapist calls, "a shift towards understanding the baby as a person with a separate, and therefore different, mind". Yet such units only allow children to be cared for by imprisoned mothers until the child is around 18 months old.

Child development experts suggest that children can become institutionalised if they remain much longer. Ms Moorcroft says: "We had one child who whenever she saw a door out on a visit she wouldn't push it but would stop and wait for someone to produce a key as though she thought all doors were locked. The prison environment had begun to affect her."

It is important to recognise that there is rarely a perfect solution, says a Prison Service policy document which concludes: "It is commonly a matter of finding the least bad option." Alison Phillips of the charity Babies in Prison – which funded the sensory playroom in Holloway prison, provides equipment and day trips to the units and spreads good ideas and practice – agrees. "Mother and baby units," she says, "are in our view the least worst option." And there are places for just 80 mothers in total.

Around 6,000 of the children affected by the imprisonment of their mother are under five-years-old, according to figures from the Howard League for Penal reform. (There are no official statistics). Around another 7,000 are between the ages of five and ten. Some have to deal with the trauma of seeing their mother arrested. All have to cope with being deprived of their mother's day-to-day love. They almost always have to leave their home and often their school. Many are separated from their brothers and sisters.

A study by Dr Joseph Murray of Cambridge University's Psychiatry Department found that they are three times more likely to exhibit antisocial behaviour, ranging from persistent lying and deceit to criminal behaviour. Individuals were affected right through to 48 years old. Nearly two thirds of boys who have a parent in prison will go on to commit some kind of crime themselves.

It begins with mood changes, hyperactivity, and what Deirdre King, author of Parents, Children and Prison: Effects of parental imprisonment on children, calls "acting up" with their carers in their parents' absence. Others, she says, become "very clingy". The children worry about their imprisoned parent. "Do you get beat up?" one boy asked his mother on a visit. They worry about the visits, which are usually not child-friendly, and where they can often be shy or awkward with their own mother.

"They are often ashamed," says Sarah Salmon of the charity Action for Prisoners' Families. "They won't tell their school or friends where their mum is. That enforced silence about their situation deprives them of support which might otherwise be forthcoming from school or the local council.

Their confusion can be exacerbated by the lies their mothers tell them. "Some mothers don't tell their children they are in jail," she adds. "

Later years throw up new problems. "My daughter Gwyneth started her periods last week," says Susan, who is halfway through a two-year sentence for arson in Eastwood Park prison, Gloucestershire.

"I had a talk with her about it before I came in. But it's hard for her not having her mum around at that time. She's 12 and just starting comprehensive."

Her son Bryn is nine. "He's been teased at school with the other kids asking him: 'What do you have for breakfast? Porridge like your mother.' Though a couple have said: 'Your mam's a gangster, that's so cool'. He's had huge hair loss because of stress and he's not gaining weight. The school have had to give him a counsellor." Teenagers, who might be supposed to be more self-sufficient, are thought by many charities to be particular vulnerable to separation from a parent due to imprisonment.

Many children become withdrawn. Some suffer depression. Children who have a parent in prison are three times as likely to suffer from mental health problems as other kids.

So many are deeply affected by their mother's imprisonment during these formative periods of their life that Baroness Jean Corston, who wrote a key report into vulnerable women in the criminal justice system five years ago, has described the impact of mothers' imprisonment on their children as, "often nothing short of catastrophic".

Not all of the problems in these children's lives can be put down to their mother's imprisonment. They were often already suffering considerable disadvantage because of their mother's behaviour before she went to jail. "Sixty per cent of women in custody have children under 18," says Debra Baldwin, the Ministry of Justice senior civil servant in charge of policy on women's prisons. "But two-thirds of them didn't have their kids living with them when they went into prison.

"These women have very damaging and chaotic lifestyles in terms of drink and alcohol use. They can be very damaged and also very damaging. So it's a real mixed picture."

Even so prison appears to be a decisive adverse factor. Dr Murray says: "The evidence does seem to point to the fact that kids whose parents go to prison do worse than those who have committed a crime, gone to court and got a non-custodial sentence."

For some children, of course, prison can be a good thing. "For some families the mother going into prison is a relief because she has been causing merry hell," says Sarah Salmon of Action for Prisoners' Families. "

Prison can have beneficial effects for mothers too. "For some women prison can be a safe haven," says Tessa Baradon. "The very aspects of the regime of the prison which brings huge resistance from prisoners – the rules, the regularity of food being provided, no drugs, no domestic violence etc – can have hugely positive results in the attachment between mothers and babies."

But however bad a mother has been," she adds, "it is rare that a child will feel more relief than loss when their mother goes to prison."

A number of changes could be made to reduce the stress on children. A more systematic programme of support could be put in place for the children of prisoners. At present unless a child is already known to school or social services as "at risk" no mechanism exists for informing those authorities that a parent is in prison.

Courts could shower greater awareness of the needs of children when passing sentence on mothers. The charity Partners of Prisoners and Families Support Group wants the introduction of a formal procedure to require courts to establish the existence and whereabouts of offenders' children before sentencing. The campaigning barrister Helena Kennedy QC wants to go further and impose a duty on a judge or magistrate to order a pre-sentencing report on the impact custody would have on the children of the family. "Good probation officers already include that but it should be a statutory requirement," she says.

Above all there is a need to ask why Britain is now sending so many more women to prison – and whether there are not punishments in the community which would be more effective and fairer to these children who get a bad deal from our criminal justice system – and through no fault of their own.

"Whenever mother is taken away from her child we punish the child as well as the mother," says Sheila Kitzinger, the childbirth activist who two decades ago campaigned successfully to have handcuffs removed from women prisoners as they gave birth in NHS hospitals. "That is particularly true of babies who are the most vulnerable members of society. To penalise them for a crime the mother has committed is an abuse of adult power.

"The mothers of small children should not be in jail at all, except in the most extreme circumstances."