If a student in London or New York goes online to pay somebody to do their essay, the chances are the work will actually end up being done by somebody in Kenya. BBC Trending reports from Nairobi on the ghost writers helping foreigners to cheat.

Kennedy used to work as a teacher but for the past five years he's made his living in a very different way. "I do academic writing," he says.

He's part of a truly global online industry, which is booming in Kenya. But what Kennedy and many other Kenyans call "academic writing", the rest of the world calls cheating.

If you're a student or a school pupil who is struggling with an assignment, or you just can't be bothered, then Kennedy and his team of writers will do it for you – for the right fee.

You then hand it in, pretend it's your own work and hope you don't get caught.

The middle men in the transaction run so-called "essay mill" websites, on which cheating students post jobs they want doing.

Many of these sites are based in the US and Eastern Europe and their cut can be as much as half the fee. How much the customer pays varies depending on whether the assignment is a simple essay or, at the other end of the scale, an entire PHD thesis.

image sourcePA Mediaimage captionSome students use essay mill sites to cheat their way to a degree

Kennedy and the writers he employs can complete up to 200 essays or online exams a month. "You log on for a student and do the exams for them," he adds.

Researchers who study the business of what's been termed "contract cheating" say Kenya is a key hub. The reasons are simple: Kenya is an English-speaking country with a good education system where there are often poor economic opportunities, particularly for young people.

For those struggling to get by, there is money to be made regurgitating knowledge for foreigners who they will never meet.

The profile pictures of the writers for hire on essay mill sites give the impression that they're all white people. But like a lot in this business, those avatars are fake. In reality if you order an essay online then it's highly likely it will actually be done by a Kenyan.

For Kennedy, joining this industry was a no-brainer. The 30-year-old makes around 150,000 Kenyan Shillings (around £1000) a month – a little bit more than the average wage – almost four times what he used to bring home as a teacher.

  • YouTube deletes cheating videos after BBC investigation
  • Essay mills: 'One in seven' paying for university essays
  • How students turn to 'essay mills' to help them cheat

But how does he feel about the fact that he's helping undermine the integrity of education around the world?

As a former teacher he admits feeling "morally compromised" but says he works for the money. "I care, but what do I care about more than my own life – at times you have to survive first to think about the morals," he says.

Kennedy is well aware that his work may help a customer to fake their way to a degree that lands them a job earning many times what he earns. "Then you realize it's not a competition against them. Sometimes it's a competition against poverty."

image captionDavid funds his own studies by writing essays for foreigners

While there are essay writers for hire in other countries, those in Kenya have developed their own subculture.

There are "academic writing" groups on Facebook and Telegram where jobs and software are traded. Some have tens of thousands of members. They range from middle class professionals dabbling for some extra cash, to students still in education.

David is one of 10 people in his final year university class who he says are financing their studies this way.

"My parents are unable to sustain my staying in school," he says. "So I just saw that I have to look for a way to sustain myself and also maybe to contribute to the family at large."

In the past two years, David has juggled his own degree work with writing around 360 essays for British and American customers. He can churn out 15 pages a day at 250 shillings (£1.65) a page. "I might work from Monday to Friday both night-time and daytime, but on the weekends I put it aside for my studies."

He's making enough to rent farm land in his home village and is hiring labour to grow crops – which he says is an investment in his future.

David is sub-contracted by somebody more senior in the industry who has a writer's account on one of the big foreign essay mill websites. But getting an account isn't easy. Some companies insist on applicants passing academic tests.

image sourceFacebookimage captionAn ad for an essay mill account being sold in a Facebook group by a black Kenyan writer

Accounts with lots of five-star customer reviews are valuable commodities and are bought and sold in academic writing groups.

This is how cheating students may actually get deceived themselves. They may think they are getting their essays done by a writer with glowing testimonials. But in reality it may actually just be somebody who bought an account with a good reputation.

"I have bought more than 10 accounts," says Kennedy. "Some cost up to 500,000 Kenya shillings (£3,300). There's no other way of getting clients."

Owning an account is something that David aspires to after he graduates. At just 23 he's already bringing on the next generation. He trains novice writers and passes on easy jobs to give them their start. "Out of it we've made friendships and we help each other. So it is an industry that is growing."

Others are not so positive about the profession. John got into academic writing after graduating. He's hoping to leave it behind after landing his dream job in the media.

"There are people who do assignments in nursing. I wouldn't really want to go to hospital to be treated by someone who paid someone else to take the exams. You know it's really dangerous. It actually gives you goose bumps," he says. "It should be abolished."

Dr Gladys Nyachieo, a sociology lecturer at Nairobi's Multimedia University, believes the greatest responsibility for tackling contract cheating lies with the wealthy countries whose students are the main customers. Without such a demand there wouldn't be a supply.

image sourceMultimedia Universityimage captionDr Gladys Nyachieo says wealthier nations should take action against essay mills

"If they could do something about it, in terms of making it outlawed on the other side, then it would reduce," she says.

Some countries are taking action. Last year, Australia banned essay selling services. Similar legislation is also being considered in England. But it's not yet clear how effective this will be in stopping a trade that crosses international borders so easily.

In the meantime Dr Nyachieo is trying to do what she can closer to home.

"I tell my students it's not ethical. It's not right," she says. "But that's all I can do. It is a matter of survival for some people. So it is kind of a dilemma."

Some of the names in this story have been changed.

Listen to BBC Trending: The Kenyans who help the world to cheat on the World Service. Download the podcast or listen online.