It might surprise you to learn that South Africa’s biggest corporation doesn’t mine the earth for diamonds, gold or silver. It doesn’t extract oil, or even produce beer. Rather, the biggest company headquartered on South African soil is an internet company. And its remarkable history tells you as much about the country’s troubled past, as it does about its promising future.

With a market value north of $42 billion, Naspers is the biggest local company on the Johannesburg Stock Exchange (dual-listed, corporate giants such as the Australian miner BHP Billiton, London based brewer SABMiller and Zurich-based luxury goods company Richemont are larger, but headquartered overseas.)

Naspers owns a vast array of media assets inside South Africa – a dominant pay TV business and more than 50 domestic newspaper titles – but its visionary investments in emerging market technology companies are what investors get really excited about. Today, its investment portfolio includes stakes in some of the world’s most exciting internet companies: Naspers was an early investor in Facebook, and remains the biggest single shareholder in Chinese internet giant Tencent, which venture capitalist Marc Andreessen last week described as “one of the most successful technology companies of all time.”

But there’s a darker side to the Naspers story that you won’t find mentioned anywhere on the company’s website or marketing paraphernalia.

Regrettable beginnings

In 1915, South Africa had only been unified politically for five years. The Anglo-Boer War, a brutal conflict between the forces of the British Empire and Afrikaners (the first white settlers on Africa’s southern tip, of mainly Dutch and French origin) had only ended thirteen years earlier. That year, a group of prominent Afrikaner nationalists and supporters of the embryonic, National Party decided to start a newspaper, which would promote Afrikaans causes, in a media dominated by English speaking publications. Nasionale Pers (National Press) was founded in Cape Town, and in July of that year, its daily newspaper, began publishing.

The first editor of Die Burger, a former religious minister named D.F. Malan, would go on to play a defining role in the darkest chapter in South Africa’s history. He championed hardline policies as editor, and later as a member of South Africa’s whites only parliament. In the pivotal general election of 1948, he led the National Party to a surprise victory over the ruling, more moderate, United Party, and as South Africa’s fourth prime minister, he would implement the policy of legally enforced, institutionalized racism known as apartheid.

Die Burger would continue to serve as the de-facto mouthpiece of the National Party and its apartheid policy for the next four decades. Although the paper occasionally clashed with the National Party, and openly criticized some policies, such as the decision to revoke voting rights from the Cape Province’s mixed race population in the 1960s, “the underlying relationship remained firm,” wrote Nieman Journalism Foundation fellow Tim Du Plessis in 1998. “Editors of Die Burger continued to attend meetings of the head council of the National Party in the Cape province as non-voting members until well into the 1980’s.”

It wasn’t until 1990 — the same year that apartheid’s most famous opponent, Nelson Mandela, was freed from prison — that Die Burger severed its ties with the National Party. Later, 127 Naspers journalists would formally apologize to Archbishop Desmond Tutu’s Truth and Reconciliation Commission for their role in defending the policy that made white South Africa an international pariah. That was in 1997, another critical year in the Naspers transformation.

From television to the internet

That same year, Koos Bekker, a Columbia Business School graduate and pioneer of pay television in South Africa, was appointed Naspers CEO. Bekker rose to prominence after successfully leading the formation of M-Net, South Africa’s first pay TV company, in which Naspers was an early investor. As CEO, he would consolidate Naspers’s pay TV interests in South Africa, and expand its pay TV footprint throughout Africa. But his next major strategic initiative would prove to be a masterstroke. It would diversify the company even further away from its origins in print, in a way that other legacy media companies could only dream of.

Getty Images/Scott Olson He never loses.

In 2001, Naspers agreed to invest $32 million for a 46.5% stake in Tencent, which at the time, was a little known and unprofitable Chinese operator of an instant messaging platform, QQ. Not much is known about how the investment came about, and the company declined to comment.

But people familiar with Naspers say Bekker, and CIO Mark Surour (who has spent time in Hong Kong) were likely behind it. Today, Tencent is considered one of the shining lights of China’s booming internet scene. It’s the market leader in messaging and mobile gaming thanks to its hugely successful WeChat smartphone app. And Naspers’ investment is now worth a staggering $40 billion. ”They were clearly in the right place at the right time,” Jefferies media and internet analyst David Reynolds tells Quartz. “They had the opportunity to invest in a business that was absolutely transformational, and the rest was history.”

Tencent went public on the Hong Kong Stock Exchange in 2004. But investors only began to truly appreciate the value of the company in the past two to three years. An 80% surge in Naspers share price in 2013 has since made Bekker (who doesn’t draw a salary and is paid only in stock options) a billionaire, and the company the darling of the Johannesburg Stock Exchange.

Naspers’s new media investments aren’t limited to China. A stake it took in the Russian holding company DST, the owner of internet portal Mail.ru, has also paid off handsomely. That gave Naspers indirect exposure to Facebook : Mail.ru was one of Mark Zuckerberg’s early backers, but it has already cashed in on that investment, arguably a little early given the social network’s 2013 resurgence.

In managing to make highly profitable investments in both China and Russia, Naspers has succeeded where countless other media and technology companies (News Corp., the New York Times, Google to name but a few) have encountered serious snags. It is a remarkable achievement.

The future

Still, the jury’s out on Naspers investments in Brazil, Turkey and India. But Reynolds says “you never lose with Koos” has become common saying in South African investment circles. “Without Tencent, I don’t think they would have anything like the level of faith from institutional shareholders, because their internet portfolio aside from Tencent and Mail has not really delivered any value,” he says.

Naspers is not the first company in South Africa, or in Europe or the United States for that matter, with a controversial past. But many of the other corporate giants of apartheid era have been bought out or moved overseas (the diamond cartel De Beers is now majority owned by British mining house, Anglo-American; SA Breweries moved its headquarters to London and bought US based Miller Brewing Company, banking giant ABSA is now controlled by Barclays).

And Naspers has taken steps to move forward. It has successfully implemented empowerment schemes to increase black ownership of its print and pay TV subsidiaries inside South Africa. (Although, it should be noted that the South African government mandates such programs.)

Rhodes University professor of media studies Herman Wasserman says the company has been criticized by right-wing groups for not doing enough to protect the Afrikaans language, as well as from media groups for its dominance of the industry. But it is largely on good terms with the current government. In fact, the company’s biggest shareholder is the government-owned Public Investment Corporation, which invests pension assets and is heavily involved in funding development activities.

“The company did a good job of repositioning itself in the democratic dispensation and strives to avoid controversy,” he wrote in an email. ”They have managed to shake their history as a supporter of apartheid.”

Correction (Jan. 12, 2014): An earlier version of this story incorrectly stated that Naspers paid $320 million, rather than $32 million, for its stake in Tencent.