The South African township of Alexandra, shown above, is next to the wealthy suburb of Sandton, an example of post-apartheid South Africa’s vast gulf between rich and poor. (Chip Somodevilla/Getty Images)

Steven Mufson, the author of “Fighting Years: Black Resistance and the Struggle for a New South Africa,” covers financial news for The Washington Post.

In May 1987, when I was working as a journalist in Johannesburg, I received a short note from South Africa’s Home Affairs Ministry saying it wouldn’t renew my visa. I had to leave the country in four days.

By the time apartheid ended in 1994, I was on my way to an assignment in China. The death of Nelson Mandela last month presented my first opportunity to visit South Africa again and catch up on a quarter-century in 13 days. As was the case when I was there before, Mandela was absent yet omnipresent. He had inspired a divided nation to reconcile, yet he left behind a country with millions of people ill-housed, ill-educated and unemployed.

Perhaps the most extraordinary changes that have taken place are the ordinary ones. In the mid-1980s, only a few restaurants in downtown Johannesburg would serve food to me, a white reporter, and black friends or sources. In December, I grabbed lunch with Khehla Shubane, a political analyst who in 1977 was jailed for helping black youth join the African National Congress. We ate at a plaza outside an upscale mall alongside people of all colors, many of whom paused to snap photos in front of a large statue of Mandela.

Back in the 1980s, apartheid, meaning “separateness,” had seeped into every aspect of life, making it impossible for young South Africans to be oblivious to politics — but dangerous for them to take part. As I was packing up to leave in 1987, Murphy Morobe, then a leader of the United Democratic Front, stopped by my apartment to discuss how the anti-apartheid group was dealing with the state of emergency that had been imposed the previous year. A sound outside suddenly made him tense and worried about the police arresting him; he asked whether I recognized the sound. I told him it was the metal bucket the cleaning man used, and he relaxed a bit. Today, people like Morobe don’t have to worry about government agents bursting in. They’re running the government. Morobe later became a spokesman for President Thabo Mbeki.

Young South Africans today have the luxury of being apathetic about politics — and that is a blessing and a curse. On the day Mandela was buried, I talked to a black couple who had brought their children to Soweto to see Mandela’s former home there. As the parents talked, the 17-year-old was busy sending texts on his cellphone. Their younger son looked bored.

Gone, too, is the sense of international isolation. In the mid-1980s, most of the world’s biggest businesses were packing up because of economic sanctions. IBM, General Motors and Coca-Cola all sold their South African subsidiaries while I was there. Zola Budd, the barefoot track star, became a British citizen to circumvent a sports boycott. Musicians steered clear.

When I returned in December, billboards advertised that Eminem was soon coming to Johannesburg; Santana and Bruce Springsteen will be touring there as well. On the way to Pretoria to see Mandela lying in state, I drove along a highway lined with international business offices. In Cape Town, a Transocean oil-drilling rig was docked for maintenance. Vodafone has established cellphone service. A U.S. private-equity firm investing in Africa has made Johannesburg its base.

Tourism is booming; in the first six months of 2013, 4.6 million people visited South Africa. At this time of year in central Cape Town, it’s likely that more than one in 10 people is a tourist. Tours of the Robben Island prison, where Shubane, Mandela and many others served time, routinely sell out.

South Africa has changed physically, too. When I was living there, the tiny township of Alexandra, crammed with 180,000 residents, had only 550 flush toilets, and 15 families shared every water tap. Small houses and shacks lined gutted dirt streets. Today, Alexandra’s crowded living conditions still lag far behind those in white areas, and the poorest residents live in shacks. But most of the streets are paved; new, bigger homes run up a neighboring hillside; solar water-heating panels dot many rooftops; and a large new train station serves commuters.

During apartheid, black townships were treated not as independent communities but as temporary quarters for workers who commuted to jobs in white cities. In the mid-1980s, the government, while deploring communism, owned all the land in the townships — as well as the nation’s television stations, telephone service, trains, airlines and electric utility. It also strictly limited business licenses in the townships, mostly issuing them to local officials who cooperated with the government. As Shubane wrote in 1991, Soweto was treated as a “colony of the white city.” Only a handful of roads led into Soweto — an acronym for South Western Townships — which had nearly 1 million people then. Most of Soweto’s roads were dirt, which created thick clouds of dust that became worse in winter when many people burned coal to stay warm.

When I went for a drive with Shubane through Soweto last month, I took a new highway to get there. “Township” was always a misnomer for this heavily populated place, but Soweto is finally becoming more of a city in its own right. There are new train stations; two shopping malls; a fancy multistory health club; some parks; and small enterprises such as hardware stores, cellphone and car-repair shops, dressmakers and hair stylists. Banks were prohibited before; today there are a few ATMs. People no longer burn coal, and the paved roads have eliminated most of the dust that once hung in the air.

So much for the good news.

In many ways, South Africa hasn’t changed — or hasn’t changed nearly as much as it should have. The country is wracked by violent crime, child abuse, alcoholism. Despite some luxury homes, most Sowetans still live in simple dwellings, many with makeshift rooms for rent in their back yards. And because burglaries are common, the most popular home improvement seems to be the building of gates and fences. Despite the growth of small businesses, more than 70 percent of Sowetans still work and spend most of their money in Johannesburg.

“South Africa 20 years hence is far better than it’s ever been, but not half of what it wants to be,” said Adam Habib, vice chancellor and principal of the University of the Witwatersrand. “If we said these things before, we would have been arrested. That’s a big change. The booing of [South African President Jacob] Zuma at the Mandela memorial service . . . 20 years ago, people would have been shot.”

But, he added, inequality has increased every year for 20 years. In October, the International Monetary Fund issued a report saying South Africa has one of the world’s highest rates of inequality. Half of the country’s total income goes to the top 10 percent of earners; the bottom 20 percent take in only 2.7 percent .

“Notwithstanding the rising black middle class, wealth, land, education, and health outcomes remain unequally distributed along racial lines,” the IMF said. “Inequality within races has also increased since 1994 .” Income per capita is up about 40 percent in the past 18 years to about $8,000, and the poverty rate has fallen by about 10 percentage points to 14 percent. But such problems would be worse were it not for the country’s social safety net, which provides payments to about a third of the population, the report said.

HIV/AIDS is also rampant, with a 17.9 percent HIV prevalence rate, second only to Swaziland’s, according to the United Nations. Just three years before I arrived, the first case of AIDS was found in the country; today there are 5.6 million. Since 2006, South Africa has boosted government spending on AIDS more than five-fold and slashed new infection rates, but it lost valuable time, in part because of former president Mbeki’s initial belief that poverty, not the HIV virus, was to blame for the epidemic.

The U.N. Office on Drugs and Crime says South Africa’s homicide rate has dropped by a third over the past decade, but it’s still 6.5 times as high as the U.S. rate and 30 times that of major European nations. In Dakar, Senegal, “I can walk in the middle of the night to a corner restaurant,” Habib says. “I can’t do that in my own city.”

Safety on the streets worries the poor and the rich. Those living in upscale areas, including newly prosperous black people, have many locks and alarms. To get into one home, I had to go through a locked door, ride in an elevator accessible only with a special key, then go through two more locked doors. In the townships, there isn’t much security. One man I interviewed in Soweto had been shot and left wheelchair-bound by car thieves; he said the police didn’t ask him any questions, and the culprits were never caught. Last Sunday, news reports said, a man suspected of raping a 15-year-old in the Crossroads shantytown near Cape Town was dragged from a pub and stoned to death .

“It’s really a long road to true freedom,” says Marcel Golding, former deputy general secretary of the National Union of Mineworkers and now chairman of a major investment conglomerate. “We built the edifice of apartheid over 50 years. To imagine we can abolish it over 20 years? It is just not possible.”

Perhaps. Yet in the mid-1990s, I was The Washington Post’s correspondent in Beijing, and South Africa would be lucky if it had half the economic growth that China has had since its own economic opening. Unlike China’s expatriates, South Africans abroad are not investing in the country in a big way. The entrepreneurial spirit in China also seems more intense.

And South Africa still relies heavily on earnings from mining — gold, coal, platinum — which accounts for nearly 60 percent of exports. More trouble could lie ahead if commodity prices fall; if U.S. interest rates (and South African borrowing costs) rise; and if European economies, the destination of much of South Africa’s exports, remain depressed.

“We’ve lost sight that it’s about abilities. We can’t conceptualize creating value out of nothing — nothing but brains,” says Mark Swilling, a professor at Stellenbosch University who believes that South Africa is suffering from what’s commonly known as the resource curse. “I’m a big critic of the minerals-industrial complex,” he says. “It’s easier to dig stuff out of the ground than create value and use brains.”

While South Africa’s challenges are daunting, there seems to be a strong desire to continue in the democratic, peaceful traditions that Mandela tried to bequeath the country.

The day Mandela was buried, I found Collen Hans, a jazz and talk-show host at Radio Jozi, a Soweto station that was licensed in 1995. In the 1980s, the government would never have licensed a township radio station.

Hans, 44, is old enough to have witnessed the changes. He was 7 on June 16, 1976, when students in Soweto rebelled and were shot down by police. “I’ve seen people killed. I was told this is what the country is,” he says.

But that’s not how he sees it now. “No one can go back there,” he says. “I am hopeful. I teach my sons and daughter that you can be the next Mandela.”

Steven Mufson, the author of “Fighting Years: Black Resistance and the Struggle for a New South Africa,” covers financial news for The Washington Post.

Read more from Outlook:

Mandela’s letters from prison built a new South Africa

Friend us on Facebook and follow us on Twitter.