If there is such a thing as an African version of California's Silicon Valley, the country that is arguably leading the race to the future is Kenya.

Household tech names such as Google, Intel, Microsoft, Nokia and Vodafone all have a presence here, and IBM recently chose Nairobi for its first African research lab.

Kenyans enjoy faster broadband connections than their counterparts in Africa's economic powerhouse, South Africa. And the government plans to build a $7bn (£4.36bn), 5,000-acre technology city that is already being branded Africa's "Silicon Savannah".

How did Kenya – a nation that still has its share of poverty and ethnic conflict – get here? "It started as a joke," said Dr Bitange Ndemo permanent secretary at the information and communications ministry. "We said we wanted to beat South Africa – and we did it."

For years Ndemo, a workaholic whose typical day runs from 5.30am to 11pm, found himself bogged down in talks with other African countries about linking to an undersea fibre optic cable that would bring high-speed internet access to millions of people.

"I did a calculation: we were spending more on hotel rooms discussing it than laying the cable," the 52-year-old recalled. "So we broke away and went it alone. South Africa thought we were joking. We didn't know anything about cables; I stayed up overnight reading about it on the internet."

That was 2007, Ndemo said, and two years later Kenya landed the cable in record time.

Since then the country has gone from fewer than 6,000 broadband connections to 6m, and from fewer than 3m internet users to 18m.

In Ndemo's grand vision, technology is not an optional luxury but rather central to 21st century education, development, economic growth – and ending Africa's reliance on foreign aid. He has ambitions for "e-learning" in schools across Kenya. "After the cable landed, we gave unlimited capacity to all the universities.

"Access enables us to become more innovative. Broadband allows people to build things you never thought of. Four or five years ago you could not put the words 'Kenya', 'innovation' and 'research' in the same sentence. Now it is starting to happen."

Ndemo, who holds a PhD in industrial economics from Sheffield University, also has a dream of online government. He claims that Kenya is the first country in Africa to adopt open source data, allowing researchers to study everything from health records to weather patterns. He wants census information to be updated in real time instead of once a decade. "We are trying to have real time digital villages. I believe that 80% of Africa's problems can be resolved through open data."

Dr Bitange Ndemo believes '80% of Africa’s problems can be resolved through open data'.

Ndemo's attempt to reduce inefficiencies and corruption has made him enemies. "People benefit from chaos and they can fight you very badly," he said. "Sometimes they tell us, 'Get out of here or we'll kill you.' I remember when we said we'd liberalise the sector, someone said: 'You won't come out alive.' But it was the best liberalisation ever."

The government has sought to avoid the over-regulation that has hindered tech entrepreneurs in many other countries. The tech workforce also benefits from relatively strong schools and universities.

There is a buzz and sense of possibility here. Kenya now has an estimated four million Facebook and three million Twitter users. In a few years mobile phone penetration has grown from less than 20% to 85%, driven by cheap tariffs and services such as five-year-old M-Pesa, which enables users to pay for goods by transferring money from one phone to another. About 17 million Kenyans, more than a third of the population, use M-Pesa and it is taking off around the world.

The current nerve centre for Nairobi's tech community is the iHub, which brings together entrepreneurs, hackers, designers and investors. It has generated 45 start-up companies since it was founded two years ago. Smart but not luxurious, on a typical day rows of young programmers sit on bright yellow chairs tapping at laptops.

The iHub was founded by Erik Hersman, an American raised in Kenya and Sudan who blogs under the name "White African". Initial funding came from the success of Ushahidi, a website initially developed to map reports of post-election violence in Kenya which has become a platform for crowdsourcing and visualising data used in 156 countries.

"Ushahidi and M-Pesa both prove something," Hersman reflected, "If you build it in Africa, it will work anywhere. There's a whole strata around that world that needs products that won't be built in Europe."

The iHub has been visited by industry luminaries such as Marissa Mayer, the president of Yahoo, and Stephen Elop, the chief executive of Nokia. Hersman, 36, added: "People from the US or Europe come to Africa because they think there's more upside. It's the last blue ocean for tech. It's untouched still.

"People here have more spending power now than 10 years ago. At the same time everything related to tech is decreasing costs. You have a great opportunity where people say, 'I can get in while it's still nascent'. It's still raw here. It's good to get market share before the big dogs come in."

One of the mobile apps operating from the iHub is M-Farm, which allows farmers to get wholesale market information and sell their products via basic mobile phones.

Linda Kwamboka, 24, one of three female co-founders, said: "It was August 2010 and we saw so many farmers complaining about unfair commodity prices, saying: 'We're not getting the benefit of our sweat.'"

M-Farm is now updated daily with the help of data collectors on the ground and has been used by more than 5,400 farmers so far.

"Technology is driving so many things," Kwamboka said. "Entrepreneurs are coming up and there's an opportunity to change people's lives."