The hot-button issue of income inequality is already shaping up as a major theme in upcoming elections. If, as some believe, compassionate redistribution from the wealthy and middle classes to the poor is the solution to income inequality, then San Francisco should be a model of egalitarianism; after all, it has pursued these policies for decades.

In fact, according to the most commonly used measure of income inequality, Rwanda is more equal than the City by the Bay.

The Gini coefficient, when applied to the Census Bureau’s most recent data, gives San Francisco a score of .523, whereas Rwanda scores .508. A smaller number is better; a score of zero indicates all wealth is shared equally.

Nations that do a better job than San Francisco at evenly distributing wealth include Panama, Swaziland, Zimbabwe, Ecuador and many others.

San Francisco’s Human Services Agency recently released a report highlighting the city as having the fastest-growing gap between the rich and poor in the nation, and a middle class that is rapidly abandoning the city altogether.

The city’s middle class has shrunk in recent decades from 45 percent of the populace to 34 percent, while the poor have grown from 10 percent to 15 percent since 2007.

So what went wrong? How is it that a city that prides itself as the most progressive place in progressive California is shrinking its middle class and growing the ranks of the poor?

One of the main culprits is housing. A recent study by mortgage information publisher HSH.com shows that home affordability in San Francisco is the worst in the nation. To afford a median-price home, a San Franciscan has to make more than $137,000 a year.

High taxes and robust regulation of both housing and private business, coupled with an activist government happy to interfere in virtually every other aspect of life, have saddled the middle class with so many burdens that many relocate to communities that are more welcoming and provide more economic opportunity.

Naturally, we cannot compare the experience of an impoverished person in Sub-Saharan Africa, for example, to the comparatively comfortable experience of poverty in the Mission District, but that disparity may actually contribute to the problem.

San Francisco mandates the highest minimum wage in the country, $10.74 an hour. If that was intended to lift a majority of the poor out of poverty and into the middle class, it has failed spectacularly.

The poor should be able to escape poverty through a robust job market that rewards their labor with greater opportunity, but San Francisco imposes both higher pay for workers and higher taxes for businesses, which naturally leads to less hiring and less chance of advancement than would be possible otherwise, especially for low- and middle-income positions.

Democrats ought to be careful this election cycle about highlighting the issue of income inequality when the cities they run without opposition have become some of the most unequal places in the nation, and, indeed, the world.

Until we learn to value how much personal and economic freedom do to generate the good middle class jobs that are the only long-term solution to income inequality, Rwanda, here we come!