Image copyright AFP Image caption M-Pesa now has about 20 million users in Kenya

When 53 police officers in Afghanistan checked their phones in 2009, they felt sure there had been some mistake.

They knew they were part of a pilot project to see if public sector salaries could be paid via a new mobile money service called M-Paisa.

But had they somehow overlooked the detail that their participation brought a pay rise?

Or had someone mistyped the amount to send them?

The message said their salary was significantly larger than usual.

In fact, the amount was what they should have been getting all along.

But previously, they received their salaries in cash, passed down from the ministry via their superior officers.

Somewhere along the line, about 30% of their pay had been skimmed off.

Indeed, the ministry soon realised that one in 10 police officers whose salaries they had been dutifully paying did not exist.

The police officers were delighted to be getting their full salary.

Their commanders were less cheerful about losing their cut.

Find out more

50 Things That Made the Modern Economy highlights the inventions, ideas and innovations that helped create the economic world.

It is broadcast on the BBC World Service. You can find more information about the programme's sources and listen online or subscribe to the programme podcast.

Afghanistan is one of a number of developing countries whose economies are currently being reshaped by mobile money - the ability to send payments by text message.

The ubiquitous kiosks that sell prepaid mobile airtime effectively function like bank branches: you deposit cash, and the agent sends you an SMS adding that amount to your balance.

Or you send the agent an SMS, and she gives you cash.

And you can text some of your balance to anyone else.

It is an invention with roots in many places.

But it first took off in Kenya, and that story starts with a presentation made at the World Summit for Sustainable Development in Johannesburg in 2002 by Vodafone's Nick Hughes.

Image copyright Getty Images

His topic was how to encourage large corporations to allocate research funding to ideas that looked risky but might help poor countries' development.

In the audience was an official for the United Kingdom's Department for International Development.

DfID had money to invest in a "challenge fund" to improve access to financial services.

Mobiles for microfinance?

And phones looked interesting.

DfID had noticed the customers of African mobile networks were transferring prepaid airtime to each other as a sort of quasi-currency.

So the man from DFID had a proposition.

DfID would chip in £1m, provided Vodafone committed the same.

That got the attention of Mr Hughes's bosses.

But his initial idea was not about tackling corruption in the public sector.

It was about something much more limited - microfinance, a hot topic in international development at the time.

Hundreds of millions of would-be entrepreneurs were too poor for the banking system to bother lending them money.

If only they could borrow a small amount - enough to buy a cow, or sewing machine, or motorbike - they could start their own business.

Mr Hughes wanted to explore microfinance clients repaying their loans via SMS.

Image copyright Getty Images Image caption Mobile phones allowed Africans to work around their often woefully inadequate landline networks

By 2005, Mr Hughes's colleague Susie Lonie was in Kenya with Safaricom, a mobile network part-owned by Vodafone.

She recalls conducting one training session in a sweltering tin shed, and the incomprehension of microfinance clients.

Before she could explain M-Pesa, she had to explain how mobile phones worked.

'Leapfrog' technology

But once people started using the service, it soon became clear they were using it for much more than repaying microfinance loans.

One woman in the pilot project texted some money to her husband after he was robbed, so he could catch the bus home.

Others said they had used M-Pesa to avoid being robbed, depositing money before a journey and withdrawing it on arrival.

Businesses deposited money overnight rather than keeping it in a safe.

People paid each other for services.

And workers in the city used M-Pesa to send money to relatives back home: much safer than the previous option, entrusting the bus driver with an envelope of cash.

Image copyright Getty Images Image caption M-Pesa transactions now account for almost half of Kenya's GDP

Ms Lonie realised they were on to something big.

Just eight months after its launch, a million Kenyans had signed up to M-Pesa.

Today, there are about 20 million users.

Within two years, M-Pesa transfers amounted to 10% of Kenya's gross domestic product (GDP) - now it accounts for nearly half.

Soon, there were 100 times as many M-Pesa kiosks in Kenya as cash machines.

M-Pesa is a textbook "leapfrog" technology: where an invention takes hold because the alternatives are poorly developed.

Mobile phones allowed Africans to leapfrog their often woefully inadequate landline networks.

M-Pesa exposed their banking systems, typically too inefficient to turn a profit from serving the low-income majority.

More from Tim Harford

The steel box that changed global trade

How the barcode changed retailing

The hidden strengths of unloved concrete

The warrior monks who invented banking

If you are plugged into the financial system, it is easy to take for granted that paying your utility bill does not require wasting hours trekking to an office and standing in a queue, or that you have a safer place to accumulate savings than under the mattress.

About two billion people are still outside the system, though the number is falling fast - driven largely by mobile money.

Most of the poorest Kenyans - those earning under $1.25 (£0.99) a day - signed up to M-Pesa within a few years.

By 2014, mobile money was in 60% of developing-country markets.

Some, such as Afghanistan, have embraced it quickly - but it has not even reached some others.

Nor do most developed-country customers have the option of sending money by SMS, even though it is simpler than a banking app.

Cultural change

Why did M-Pesa take off in Kenya?

One big reason was the relaxed approach of the banking and telecoms regulators.

According to one study, what rural Kenyan households most like about M-Pesa is the convenience for family members sending money home.

But two more benefits could be even more profound.

The first was discovered by those Afghan police officers - tackling corruption.

In Kenya, similarly, drivers soon realised that the police officers who pulled them over would not take bribes in M-Pesa: it would be linked to their phone number, and could be used as evidence.

Estimates suggest that Kenya's matatus - public transportation minibuses - lose a third of their revenue to theft and extortion.

Image copyright Getty Images Image caption Will mobile phone-based payment systems cut fraud on Kenya's buses?

In response, Kenya's government announced an ambitious plan to make mobile money mandatory on matatus - after all, if the driver has no cash, he cannot be asked for bribes.

But many matatu drivers have resisted.

Cash transactions facilitate not only corruption, but also tax evasion.

When income is traceable, it is also taxable.

That is the other big promise of mobile money: broadening the tax base, by formalising the grey economy.

From corrupt police commanders to tax-dodging taxi drivers, mobile money could lead to a profound cultural change.

Tim Harford writes the Financial Times's Undercover Economist column. 50 Things That Made the Modern Economy is broadcast on the BBC World Service. You can find more information about the programme's sources and listen online or subscribe to the programme podcast.