Mr Clegg made his comments in a letter in the Daily Mail
Holding hundreds of children in immigration detention centres is "state-sponsored cruelty", says Liberal Democrat leader Nick Clegg.
In an open letter to Gordon Brown, he says the practice is indefensible and causes children mental distress.
He also accuses the government of trying to "cover up" the practice by not releasing figures of children held.
Last month MPs said nearly 1,000 children a year are detained while awaiting deportation from the UK.
The home affairs committee said some were being held for up to two months and should only ever be held as a "last resort".
In an open letter in the Daily Mail, Mr Clegg urges the prime minister to put an end to the practice.
He writes: "One of the best ways to judge the moral compass of a nation is how we treat children - all children.
"There is now concrete evidence that the very young children who find themselves locked up even though they've done nothing wrong are suffering weight loss, post-traumatic stress disorder and long lasting mental distress.
"How on earth can your government justify what is in effect state-sponsored cruelty?"
Mr Clegg says while Britain must keep track of adults seeking asylum it is "simply indefensible to do so at the cost of the mental and physical wellbeing of very young children".
He accuses the government of consistently refusing to give total figures of the number of children detained.
"This attempt to cover up such a morally reprehensible practice only makes matters worse," writes Mr Clegg.
The home affairs committee said nearly 1,000 children a year were detained while they and their families await removal from the UK.
On average, they spend more than a fortnight in detention, although periods of up to 61 days are not uncommon, it said.
Responding to that report last month immigration minister Phil Woolas said: "When the independent courts find a family has no need for protection, we expect them to return home rather than putting in frivolous appeals that clog the legal system.
"We prefer families return home under their own steam - enforced removals are very much a last resort."
Children's Commissioner for England Sir Al Aynsley-Green has said the practice of holding children in detention should end.