Image copyright Remand /Revolution Pictures

Ugandan schoolboy Tumusiime Henry was 15 when he was accused of murder the first time. While he waited almost two years for the trial to begin he was accused of a second murder. But then he met an American lawyer who slowly realised it was up to him to come to the rescue of an innocent teenager.

Henry was at school when the men came for him. They were not wearing uniforms, so he did not realise at first that it was the police, but then they pulled out the handcuffs. "I was like, 'My God, what's this?'" he says. He and his younger brother, Joseph, were bundled into a police van and were shocked to find their mother inside.

"Just be calm. God will help out," she said.

A few days earlier, a calamity had befallen the family. Henry's father had been saving money to pay for his education. In addition to the income from their small farm, the family had glued together envelopes and sold them for a few pennies, while Henry's mother had cooked chapattis for village restaurants. The hope was that Henry, always top of his class, would be the first in the family to go to university.

But then the money vanished from under the mattress, and along with it Imanriho, a man who had worked on the farm as a herdsman for many years.

In Uganda they arrest first and then they investigate later

It was not long before someone from the village spotted the culprit at the market in the nearby town of Hoima, and dragged him back to account for the missing money. A mob set upon him. Henry heard the commotion at school, but did not know what it was about and was not allowed out. His father, however, rushed to the scene and tried to stop the attack. "Enough! Let me get him some water," he cried. But at that moment someone dropped a huge stone that crushed Imanriho's head.

The crowd dispersed, leaving Henry's father with the dead body. He had been a part of the family, even if he had run away with their savings. He decided to bury him in his field.

It was this that led the whole family to be arrested on suspicion of murder.

"In Uganda they arrest first and then they investigate later," says Henry. The two boys - aged 15 and 13 - were locked up in Hoima jail with their father, although their mother was released.

Image copyright Jan Banning Image caption The police do not earn much in Uganda - this officer in Jinja, eastern Uganda, earns 205,000 shillings (£44 or $60) a month

After two months in the adult jail, Henry and Joseph were sent to a juvenile remand centre in Ihungu, about 50km (30 miles) away.

The single concrete dormitory block was dark and overcrowded, with just a few sleeping mats on the floor. There was no fence, but there were many rules in place to prevent escape. The brothers had to give up their shirt and shoes and were kept apart. One of the teenagers acted as leader and was given the title of "katikkiro" - which means "prime minister" - it was their job to enforce the rules and punishments.

The group of 20-odd young people were meant to be looked after by a matron called Rose Mpairwe, but she broke the rules and sent them out to work illegally in the fields.

Henry soon found out what happened when you broke her rules. Walking to work on the first day he carried his hoe on his shoulder - this was forbidden. "I took it down but they had already seen me, so I got a beating," he says.

The teenagers would start work at 6am and weren't fed until after they got back at 11am. Henry and his brother were not used to such hard labour. "We had no experience of digging at that pace. If we lagged behind, we would get less porridge," he says.

Image copyright Divine Collision Image caption Ihungu Remand Home where Henry was held for nearly two years

The warden in charge of the remand centre was unaware of what the matron was up to and nobody dared to tell him. "I had a fear - so I couldn't express myself fully," says Henry.

Still, the brothers settled in and after a while the warden appointed Henry prime minister. He took his duties seriously. "I struggled to lift up the voices of any fellow prisoners who were not listened to," he says.

And being prime minister made life more bearable. "I got relief from beating and I was allowed full access to my brother."

Image copyright Jim Gash

Find out more

Towards the end of 2009 some new boys arrived. One of them, called Innocent, was in a bad way - he had asthma, and had already spent three days in a police station without any medicine. He also had cuts on his hands from being tied up.

"I had a clue that he was sick - he worked slowly," says Henry. "Rose wasn't happy with that. She really wanted to make him work." Henry explained to her that Innocent was sick, but she didn't believe him. "He really couldn't lift the hoe," says Henry.

The matron ordered Henry to beat Innocent. When he protested, she slapped him and warned him that he would lose his position as prime minister. The thought of losing access to his brother was too awful - Henry felt he had no choice.

"I gave him a few strokes to impress Rose, but she wasn't satisfied," he says. In fact, his lenience angered her further, and she then made the boys bury Innocent up to his neck. This distressed everyone so much that he was quickly dug up again.

Innocent was then given lighter duties - clearing a piece of ground which was going to be dug up the next day. He saw a chance to escape, and seized it. Henry was sent to chase the sick child. "I easily got him and brought him back," he says.

To punish Innocent for his escape attempt, Mpairwe ordered four of the newcomers to give him 10 strokes each with the cane - 40 in all. "Innocent couldn't scream by that time, he was really suffering," says Henry. "He asked for water, she said no. No-one moved - we did not dare to take him water. Rose was the controller of everything."

Obviously unwell, Innocent was taken back to the remand centre by motorbike - the others followed on foot. Henry was told to take him to hospital, but by the time he reached the dormitory, it was too late. "I called Innocent, but there was no reply. I went close to his bed. It was all dark. Innocent was dead," he says.

Henry was deeply upset. "This was my fellow prisoner," he says. "What should I do?"

When Henry told the warden what had happened, he tried to reassure him. "You have nothing to worry about, I believe in you," he said. But Henry was not so sure.

When the police came the next day, they arrested the matron but, as prime minister Henry was also held responsible.

Eighteen months after being taken from his classroom, he was now charged with two murders and began to feel he would never be released.

"I told my mum not to come and visit me again," Henry says, "because I had really lost hope by that time."

Then in January 2010 some American lawyers arrived in Ihungu. One of them was Jim Gash, a law professor at Pepperdine University in California. The university's law school had developed a close relationship with the Ugandan judiciary, providing free training and sending students over to volunteer during the summer vacation.

I had kids that age and I was just thinking - this is not OK with me Jim Gash , Lawyer

It was the first time Gash had been to Uganda. After hearing reports of young people left languishing for long periods in an "up-country" remand centre, his team planned to spend a week preparing the teenagers' defence cases so that they could finally be brought to trial.

"I was a 'volun-tourist'," he says. "I thought this was going to be a one-time thing." He had no idea how deeply involved he would get.

"When I walked in I was just shocked and emotionally shaken because there is no electricity, no running water, no beds - there were just thin mats on the floor, with slits in the upper part of the wall [for ventilation] with no mosquito nets, and the kids were just in a hopeless state of disrepair clothing-wise," says Gash.

Image copyright Jim Gash/Divine Collision Image caption Jim Gash was shocked by conditions in the remand dormitory

"I had kids that age and I was just thinking: 'This is not OK with me, somebody's got to do something about that - but at the time I didn't think it was going to be me.'"

The team had not brought a translator, but when they arrived in Ihungu they discovered that only two of the 21 prisoners spoke English: Henry and his younger brother Joseph.

The Americans split into two groups - Joseph helped one team, while Henry was assigned to translate for Gash.

"We walked him through what kind of information we needed and he acted like he understood completely," says Gash. "And over time we realised he did, because he's really smart."

Henry spoke five languages but sometimes even that wasn't enough. "There was one kid who spoke a language that only one other kid spoke, so I would ask Henry in English and then he would interpret into this other language and then that boy would interpret into the native language of the defendant," says Gash.

Image copyright Divine Collision Image caption Gash interviews a remand prisoner in Ihungu while Henry translates

Some of the teenagers didn't even know what they were charged with. Others admitted their misdemeanours. Several were there because they'd had sex with their girlfriends before the girls had reached the age of 18. There were some tragic stories.

"One boy confessed to stealing a gun in order to kill himself," says Gash. "He was a member of the Lango tribe in an area where this tribe wasn't accepted and his parents had died a few years earlier. Even when we were with him, he was quite despondent."

Another girl had given birth to a sick baby and was accused of murder when it died.

To corroborate their statements, the lawyers also paid for witnesses to travel to the remand centre. One man made his own way, walking for seven hours to give his statement.

Eventually Gash turned his attention to Henry. Before arriving in Ihungu the Americans had been nervous about meeting this boy accused of two murders, but he was nothing like what they expected. "He's a little guy - he's 5ft 4in (162cm) and weighs about 120lb (55kg) - so I didn't feel physically in danger, but nevertheless it was an odd situation," says Gash.

While he spoke to Henry, Joseph was interviewed by the other team. Their stories matched exactly. Both said they were in school when the mob attacked, and that no-one had been allowed to leave.

The lawyers then called the headmaster, who confirmed the story. "When the mob rushed by the school we shut everything down - I went into every single classroom and made sure the teachers knew that no-one is allowed to leave," he told them. The lock-down had begun at 9am and it wasn't until the end of the school day, long after the mob had dispersed, that anyone was allowed out.

Image copyright Jim Gash/Divine Collision Image caption Jim Gash with Henry and Joseph in the remand centre

"There was no question in our mind, these kids are being held unjustly," says Gash.

By then, he and Henry had begun to bond. "He's a strong person of faith as well," says Gash, a devout Christian. "But more than anything it was: this kid needs help."

It wasn't all work. Between interviews, the lawyers would chat and play football with the boys. During one such break Gash showed Henry his mobile phone. "Yours is better than mine," said Henry, and took out his. Gash was astounded that he had one, but Henry was still the prime minister, responsible for his fellow prisoners, and needed to be able to call for help if anyone got sick or hurt.

Then Henry held up Gash's business card and asked if that was the number for his mobile phone. It wasn't, but at that point, Gash decided to go the extra mile - he gave Henry his mobile phone number and promised to stay in touch.

When he landed back in the US, he switched on his phone to hear the message: "Hello Mr Jim, this is Henry. I hope you had a safe journey, thank you for coming to see us."

Since then, the two have spoken every week.

Image copyright Remand/Revolution Pictures Image caption Henry was lonely when he returned to the remand home

Two months later, in March 2010, both of Henry's cases - and those of his fellow prisoners - went to court. In Uganda, groups of up to 40 cases are scheduled at the same time for efficiency - that way if witnesses haven't appeared for one trial, the court can get on with the next one.

The first charge - the killing of Imanriho - was dismissed immediately. Henry's father and brother were free to go, but Henry had to return to the remand centre until the conclusion of his other trial, on the charge of murdering Innocent.

He felt lonely - not only was his brother gone but 17 of his fellow prisoners had also been released.

Several were found not guilty and released, but many of them pleaded guilty to the offences because the punishment that they would receive was shorter than the time that had already been served.

For his second trial Henry shared a lawyer with his co-accused, the matron, Mpairwe.

Worryingly, while at court, Henry's father had seen one of her witnesses accept a bribe, while being told to put the blame on Henry.

More worrying still was the defence lawyer's strategy - because Henry was only 17, he could get no more than three years for a capital offence, so the lawyer decided to focus on defending his other client, who faced the maximum penalty.

"The lawyer told me not to defend myself and told Rose to defend herself," says Henry. "I was really confused. I was trusting him as my lawyer but I was very concerned."

Back in the US, Gash listened to these developments with increasing frustration.

It then turned out that the lawyer intended to lay all the blame on Henry - it was her word against his. No witnesses were called to defend him, and he himself was not asked to testify.

On the day of the verdict, 22 April 2010, the court found both parties guilty of murder. Mpairwe was sentenced to 10 years. Henry's sentence depended on a medical examination to prove that he was a minor. If he was found to be an adult, he could face the maximum penalty: death.

"That's when I got on the next plane," says Gash. "I didn't know what I was going to do, but I knew somebody I cared about was in great distress."

Birth records in Uganda are not always reliable, so courts ask doctors to determine the age of a defendant. Henry had been examined twice already, but this time the court said he had to be seen by a police doctor.

Image copyright Jim Gash/Divine Collision Image caption Henry and Jim have grown close

This made Gash nervous, because of the possibility of corruption.

"Corruption is an issue," he says. "It's not as big at higher levels, like the High Court and above, because they are sufficiently compensated - but in the police it's a huge problem because they're so poorly paid that they supplement their income."

Henry's family had no money to bribe anybody, and would not have been willing to stoop to it, Gash says, "or they could have been out a long time ago".

Gash waited anxiously while Henry was taken back to his home town to be examined.

"That was one of the most tense times in my entire life," he says. "If the other doctor said he was 18, getting a death penalty, or getting a sentence of 25 or 30 years, was a very real possibility."

Image copyright Jan Banning Image caption Inmates in Luzira maximum security prison - those in white are on death row

One man who knows a lot about the death penalty in Uganda is Edward Mpagi.

His 18 years on death row in Kampala's maximum security Luzira prison ended before Henry was even arrested but their cases have much in common.

Both began with a theft. Mpagi's neighbour, William Wandyaka, was robbed and because their families were embroiled in a long-running dispute over land, suspicion fell on Mpagi.

Again, the whole family was arrested - Mpagi, his cousin Fred Masembe, and their parents - although the parents were soon released.

The two young men spent a year on remand in the local prison during which time they only met their lawyer twice. When Mpagi stood before the High Court judge, he was horrified to hear that the charge was murder, not robbery. He didn't even know that anyone was supposed to have died.

"It was terrible," says Mpagi. "Because if you are innocent you have no words to say."

Image copyright Scott Langley Image caption Edward Mpagi was condemned to death for a murder that never even happened

Mpagi watched as four people testified falsely that they had seen him with a gun. Like Henry, no witnesses were called for his defence.

The truth was that not only was there no gun, there was no victim. Wandyaka was alive and well, and had simply gone into hiding. "He was staying very far from home, just coming home at night - he couldn't expose himself," says Mpagi.

The "murder" had been faked to settle a score. "In our culture, if somebody attacks your children it hurts you very much. That's what they did," says Mpagi.

Mpagi and his cousin were sentenced to death and taken straight to Luzira, where the death row cells were meant for one man but housed four or five. "We would share a small bucket as a chamber pot. And we used to have diarrhoea, because of dysentery. It was terrible," says Mpagi. Inmates were only allowed out of their cells for half an hour a day, to empty the buckets.

Masembe fell ill with asthma and diarrhoea but was refused treatment and died in 1985.

Mpagi outlived not only his cousin, but also about 180 other men who died of diseases such as dysentery, cholera and TB - and the much smaller number who were actually executed.

The last hanging of civilians took place in 1999, when a group of 28 prisoners were taken out to die.

Before that, there were five other executions, of three to nine prisoners each, between 1989 and 1996.

Mpagi heard every one from his cell.

"We could hear them crying, saying farewell to us," he says.

As in Henry's case, a foreigner tried to help. In this case an Italian priest went to Mpagi's village and verified that his "victim" was still alive. A group of 90 villagers wrote to the attorney general to confirm that no murder had taken place, but years passed before he finally received a presidential pardon.

Released in 2000, Mpagi started visiting Luzira as a Catholic preacher, to provide comfort to prisoners. He still visits death row every week and says the situation there is improving, with prisoners now taking part in educational activities.

Image copyright Remand/Revolution Pictures

In 2005 the constitutional court of Uganda also ruled that long delays in carrying out executions amounted to cruel, inhuman and degrading treatment, so now any prisoners held on death row for three years have their sentences commuted to life.

One thing hasn't changed though, Mpagi says. "Most prisoners do not have lawyers and still need somebody to follow up on their cases."

And Uganda is still sentencing people to death, even if the sentence is not being carried out.

Image copyright Scott Langley Image caption Since his release Mpagi has remarried and set up a school for children of prisoners

Compared with Mpagi, and many others, Henry was lucky.

The police doctor confirmed that he was under 18, which meant he was sentenced to a year's probation by a juvenile court. He had already served twice that, so he was released immediately.

His two years on remand had been full of anguish and hard to endure, but many Ugandans have to wait longer for their trial - an average of five years.

This causes innumerable problems. "By the time the case comes up, witnesses either have died or relocated and are no longer interested in testifying," says the director of public prosecutions, Mike Chibita.

It also means Uganda's prisons are hugely overcrowded. Luzira prison, with a capacity for 600, houses more than 2,500 prisoners, more than half of them are on remand.

To tackle the huge backlog of cases a new idea is being piloted - a form of plea bargaining. Prisoners can volunteer to plead guilty in return for a reduced sentence. No witnesses need to be called, so court cases can be concluded in an hour rather than the usual three months. It also means witnesses can't be bribed.

"Corruption is always an issue, but less so in plea bargaining," says Chibita. He believes that clearing the case backlog will give overwhelmed courts time to concentrate on those prisoners who continue to protest their innocence and result in fairer trials.

Image copyright Jan Banning Image caption The Ugandan justice system is overwhelmed - these are files at a magistrate's court

The idea of plea bargaining was originally suggested by two students from Pepperdine in 2009 and when Gash was in Uganda to prepare Henry's pre-sentencing report it was raised again, by a High Court judge. "What can we do to ensure there are no more Henrys?" he asked Gash.

Gash later moved to Uganda for six months to help implement the new system. This meant he was able to visit Henry, who was back at school and doing well. But it bothered Gash that Henry had a criminal record. He knew this would affect his future, and wanted to appeal.

Then he discovered there was a provision in Ugandan law that allowed visiting lawyers to act for a client, as long as they were supported by a Ugandan lawyer. It had only been done once before, with a lawyer from Kenya.

Image copyright Jim Gash/Divine Collision Image caption Henry with his appeal lawyers, Edward Sekabanja and Jim Gash

On 12 March 2013 Henry's case was heard at the Court of Appeal. Gash represented him and became the first American lawyer ever to plead a case in a Ugandan court. Then, they had to wait.

"In Uganda you can spend a long period of time waiting for justice," says Henry.

In 2014 Henry fulfilled his greatest dream when he was admitted to university in Kampala to study medicine, though his father did not live to see it - he had died of liver cancer just months before.

Two years after the appeal, on 19 June 2015, Gash received a copy of the verdict by email, after it had been read in open court. The conviction was quashed - the court found that Henry had not had a fair hearing, and also ruled out a retrial.

Image copyright Jim Gash Image caption The moment Jim read out the verdict to Henry via Skype

He immediately called Henry via Skype and read the verdict out to him, in a shaky voice. "You are a free man - you are exonerated. All of the charges against you have been dismissed."

"I want to extend my appreciation for having been represented by a very good, perfect lawyer," said a beaming Henry.

Gash replied: "I had a very good client to represent—someone who was innocent and needed to be proven innocent."

"When Jim cleared my name, oh God, I was really happy. I was overwhelmed. I can't express my happiness when my name was totally cleared," says Henry, who is now 22.

Gash has written a book about Henry's case, and his role in it, called Divine Collision. "Henry's life had been transformed," he writes. "Because of his case, Uganda's criminal justice system was being transformed. And I was transformed."

Media playback is unsupported on your device Media caption Documentary Remand: Global Justice in Uganda follows law students visiting Luzira prison - courtesy of Revolution Pictures

All images subject to copyright

Henry and Jim's spoke to Outlook on the BBC World Service.

You can also hear Outlook's interview with Edward Mpagi

Subscribe to the BBC News Magazine's email newsletter to get articles sent to your inbox.