In the past 12 months, around 600 armed forces personnel were sent to the UK's only military detention centre. The BBC has been given rare access to the centre to find out if there are lessons to be learnt for mainstream jails.
The Military Corrective Training Centre (MCTC) in Colchester, Essex, is often described as a prison for soldiers.
The government insists it is not a jail but a rehabilitation facility which retrains and educates servicemen and women, as well as civilians, who have offended against military law.
But there is no doubt this is a detention centre.
The large iron gates and the locked doors to the various sections of the compound are a reminder that the detainees under sentence (DUS) are in custody.
From the outside, the red-bricked buildings could pass for a school or town hall, but inside, military staff are on duty.
The windows are not barred but the thick, black, densely slatted frames give the clear impression of incarceration.
This is the only custodial centre of its kind in Britain, and is available to the Army, Royal Navy, and Royal Air Force.
The site was a prisoner of war camp until 1947 but the MCTC, in its current form, was officially opened in 1988.
It's an early start here. Detainees are up by 06:00.
Their first job is to clean their dormitory and prepare for the daily rigorous inspection.
In most cases, up to eight detainees share a room furnished with basic metal beds with mattresses, a couple of shelves, and a television that is switched on for only a limited time.
Staff say the majority of the day is spent on a tailored rehabilitation programme which involves physical exercise, academic study, and specific counselling, depending on the offence.
The dorms are locked from 19:00 onwards and lights are out three hours later.
A 21-year-old army detainee, who was not allowed to give his name or talk about his offence, had just completed his sixth week at MCTC.
He admitted it had been challenging: "At the start, getting locked down at seven o'clock, it takes some getting used to, you know what I mean, but coming from the Army, to be honest, makes it a bit easier because you're sort of used to getting told what to do and doing the routine and all that."
Every detainee wears their uniform with a colour-coded badge attached to the front which denotes the seriousness of their offence.
There are two ways in which they are sent here.
The first is a summary hearing where their commanding officer will have decided that detention is necessary.
The second is through a military court, known as a court martial, which is governed by the Armed Forces Act 2006. A judge advocate presides over the court. The jury is called a board and is made up of a panel of officers and warrant officers.
If a member of the armed forces commits a serious crime like rape or murder, they could still be tried by a court martial depending on where and when the offence took place.
The staff at the camp insist the focus here is on education with more than a dozen courses on offer including plumbing, welding, and animal welfare.
But the centre's commandant, Lt Col Ian Logan, says that for many, the rehabilitation does not end once they walk away from the gates.
"Every detainee is a challenge, and I'm not in control of how long they stay here. In some cases, when they're here for short periods, we're reliant on the commanding officer of the detainee to continue to monitor and develop him from what he started here," he says.
Only 8% of those who come to MCTC reoffend, compared with the latest civilian prison reoffending rates of around 25%.
Even though the MCTC does not define itself as a prison, it is regularly checked by Her Majesty's Inspectorate of Prisons (HMIP).
The chief inspector of prisons, Nick Hardwick, said he was impressed with the focus on rehabilitation from the outset, and the culture of high expectations.
He said: "Of course, the young people held in Colchester do not have the very severe difficulties of some of those held in civilian young offender institutions and prisons, but there are striking similarities and there is a good deal civilian establishments could learn from the good practice in Colchester."
Its latest report gave a glowing review of the centre and specifically praised the working relationships between staff and detainees.
The Howard League for Penal Reform believes MCTC is an impressive facility but thinks it is unfair to compare it with a civilian prison because most of its inmates have offended against military rules, rather than the criminal law.
Spokesman Andrew Neilson told the BBC that although the military's programme was successful, the much greater numbers involved in civilian prisons meant the overcrowding problem would make the model unworkable.
He said: "We have over 84,000 people in prison in England and Wales and our jails have been overcrowded since the mid-1990s.
"Colchester does show what you can do with very small numbers and focused one-on-one activity but as the government continues to struggle with the prison population, it is now looking to build super-sized jails that can hold up to 2,000 people."
For the detainees at the MCTC, their daily regime is arduous. But those to whom I spoke, admittedly within earshot of senior officers, suggested the ordeal had been worthwhile.