Anyone would guess it was a prison. Its four-metre-high walls are topped with coiled barbed wire and punctuated with watchtowers. Its tall metal gates are locked. Yet a glimpse through one door, left slightly ajar, reveals its inmates died years ago. The site in Monrovia, Liberia's capital, is an abandoned cemetery where no one has been buried for decades. The walls aren't there to confine the dead, but to keep out the living – people whom Liberian society has forgotten who inhabit its crumbling tombs.

"There was a body there, but I took it out and threw it away," says Junior Toe. A veteran tomb dweller, as those occupying the cemetery are known, he has lost count of his years living among the dead. Standing on the worn edge of an open tomb, he peers into his second-hand bedroom. The empty space, about two-metres deep, is finished with stained green tiles crossed by vines. "When you look for a tomb, the body can't be too fresh," he advises. "It has to be really dead, then you can clear it away into a bag."

In the wake of Liberia's Ebola epidemic, a cemetery seems the last place people would live. The West African nation has become synonymous with a deadly virus that tallied almost 10,000 cases in the country from March 2014. Ebola kills indiscriminately and is contracted through bodily fluids. Dead bodies are particularly contagious.

But before 2003, it was pictures of slaughtered families and child soldiers that flooded the media during the country's 14-year civil war. It is this earlier, lawless Liberia that first prompted people to flee to the city-centre cemetery. Many arrived as children – some as young as 10 – after been orphaned.

Junior is one such resident. He is unsure of his age, but recalls being seven when his parents were killed, leaving him on the streets. "Friends brought me here to smoke," he explains. Junior's marijuana habit spiralled into stronger drugs such as cocaine and heroin. Soon the vast, oblong tombs became an attractive shelter and hiding place.

Before the war, the Palm Grove Cemetery looked like other Liberian graveyards. Tombs were decorated in vibrant colours and it provided a final resting place for prominent Liberians, including former president William R Tolbert who was killed in a coup d'etat in 1980.

But when peace returned, families visiting the graves found them smashed open and stripped of their valuable steel rods. Bodies had disappeared, along with treasures buried with them. Monrovians grew hostile towards the tomb-dwelling population, viewing them as criminals, prostitutes and drug addicts. Every year on Decoration Day – a public holiday when Liberians repaint family graves – conflict erupts at the cemetery.

One of the cemetery's residents smokes drugs inside a tomb (Hannah Maule-Ffinch)

Sam Burnette III, a Monrovian whose father is buried at the site, says that, last year, two young females accosted a family friend who tried to renovate his father's tomb. "They said he had to pay them to clean the family grave," he explains. "They had a bucket of human waste and threatened to throw it on the grave if he didn't pay."

A public outcry led President Ellen Johnson Sirleaf to erect a wall around the cemetery in 2007. But security measures dwindled and its homeless residents broke in. Ironically, the walls now hide the tomb dwellers' activities.

What the walls conceal is repellent. The stench of human excrement hangs stiflingly in the hot air. The cemetery's broken tombs rise and fall like a low-rise cityscape. Giant plants thriving in Liberia's wet season nearly obscure the concrete forms, making crossing the uneven terrain precarious. Jagged headstones are ready to trip, while open graves wait to snatch-up new occupants. Fat centipedes scurry over glass and rubbish, and scattered, used matches betray recent crack cocaine use.

During the day, male tomb dwellers walk to town to earn money for their next hit. Junior washes cars. Others work as casual porters or pickpockets. They stash stolen items among the tombstones, but within the community there is little security. "People steal my belongings if I hide them among the graves," says Junior. "But if I see things hidden I'll also take them," he laughs.

Despite introducing his shady world with bravado, Junior wants to leave. "Some of us call ourselves 'the friends of the dead', but saying this doesn't make me feel good," he says. "People outside of here treat me like I'm not there. I'm not a part of society anymore."

At night, men arrive at Center Street, which bisects the cemetery, searching for prostitutes. Most female cemetery dwellers, some children, survive through sex work. Mercy Howatt, 17, has worked here for six years. She also lost her parents during the war, and she shares a tomb with two friends. Her eyes are yellowed from drug abuse and her jacket sags off her emaciated frame. "I have sex with men in the cemetery," she says. "For 10 minutes I make 200 Liberian dollars (£1.45)."

Mercy believes the cemetery vaults provide better shelter than street-living. But regular police raids undermine that protection. "They come to drag us out – I have scars from where they've beat me or I've run and fallen," she says. "I don't feel safe here . I cross myself before I sleep. But I take drugs and they make me feel brave. I couldn't sleep without them."

Mercy Howatt, 17, on Center Road, where she has worked as a prostitute for six years (Hannah Maule-Ffinch)

Rape is common in Liberia and seldom reported, but the cemetery girls have lost any rights to protection. "A customer can beat or rape you," says 18-year-old Soni Smith. "We complain to the police but they never go and look for that person, because we don't have money to pay them." She claims even the police are rapists. "Because you smoke, they arrest you, so you give them what they want to be free."

Soni is a more recent arrival, coming two years ago when her father died suddenly. In latter years, the cemetery has attracted young people orphaned through sickness or poverty, or those who fall into drugs through peer pressure.

Like many of the girls, Soni has given birth to a child in Palm Grove. After struggling to raise her son among the graves, she saved money to travel out of town and abandoned him on a relative's doorstep. "It was very difficult for me but I had no option," she explains, her eyes lowered. "Because of my prostitution, I had to leave him alone in the cemetery to work. Every day I think about him, but I'm not sure I'll see him again."

Soni boosts her income by dealing drugs. "For every 10-pack you sell, you get to keep one," she enthuses. "I smoke as many as possible – every hour we try to get more drugs."

A hit-free day is what she fears most. There are many deadly illnesses in the cemetery and Ebola is of little concern. "Most people here have tuberculosis, runny stomach and rashes, because you're dirty and not eating properly," she explains. "The worst is tuberculosis – we share pipes and needles so it's easy to pass on. I've seen many people die."

In a corner of the cemetery, older inhabitants have turned a once-ornate sepulchre into a crack den. It has legendary status as the burial site of a rich prostitute, fondly named Cinderella. Inside, Steve Sam, 32, leans against the concrete prism containing her remains. He skilfully cooks drugs on tin foil.

JuniorToe who has lived in a two-metre deep grave for more years than he recalls (Hannah Maule-Ffinch)

"We three went with the past government in the artillery unit," he says. Sam was among the estimated 15,000 child soldiers abducted during the war. After former president and war-criminal Charles Taylor's army murdered minors' parents, the soldiers handed them guns, gave them drugs, and made them kill. After Taylor's victory they abandoned them.

Sam leans over and inhales through a thin pipe. Rainwater drips from the ceiling as he stares through gaps in the decorative masonry. "I went to school until ninth grade," he muses. "If I had support I would go back."

Sam's hopes could become reality. Until now, no one has viewed the tomb dwellers as redeemable. The walls were an inhumane way to deal with a social problem, while police raids only temporarily displace the issue. But in 2014, British charity Street Child began engaging cemetery residents.

"This is a group of human beings people have given up on," says director Michael John Bull. "The authorities consider them miscreants and nobody wants anything to do with them." Bull and his team have won their trust, but the task is challenging. The young people's narcotic state means they can be abusive.

Ebola has also seriously hampered efforts. The charity was providing group counselling, but bans on public gatherings made this impossible. Street Child also agreed a partnership with the US Agency for International Development to begin adult-education classes, but the nationwide closure of schools halted this project. In addition, the charity diverted its resources to provide emergency care to some 2,000 Ebola-orphaned children.

However, with Liberia almost Ebola-free, Bull is restarting efforts. Classes are set to begin this year and he is discussing a programme with a local drug-rehab clinic, although breaking the group's deep addictions will prove tough.

"As long as they are where they are it will be very difficult," says Bull. "We have to reunify them with families or connect them with a job or place to stay. But that will involve more money."

Winning financial support for such an unpopular cause will be problematic. Even before the Ebola outbreak, the government budget for child protection was low and dependent on foreign aid. A spokeswoman at the Ministry of Gender, Children and Social Protection also told Bull the police must be involved. But the police's attitude has often been hostile.

Soni Smith, 18, who moved here after her father died two years ago (Hannah Maule-Ffinch)

There is a police depot on the same road as Palm Grove, but its officers deny young tomb dwellers exist. "I haven't seen children in there," says head of division Jusu Maxwell. "Only criminals use it as their home." He claims the high walls ended exhumations and police raids have since been unnecessary. The tomb dwellers say this denial is proof police are profiting from their drug dealing.

Despite these barriers, Bull believes it is possible to save these forgotten people. He recently helped Mekey Philips, 13, to leave after three years prostituting herself at the burial ground.

Last year, Mekey gave birth to a son and vowed never to return. "He wouldn't survive if I brought him here," she says, standing outside the cemetery. She has come to see her friends, but hands her baby to a social worker before entering. She recalls seeing babies die in the cemetery and says mothers buried them themselves in makeshift graves.

After the birth Mekey quit prostitution and drugs and survived through begging. "When I stopped taking drugs I was sickly for a month, but now I feel better," she explains. Bull encouraged her to identify a relative who might help. She convinced an uncle to support her, and Bull gave him a small-business grant to help generate a lasting income. The charity is now helping Mekey return to school.