Several members of Congress boycotted or protested President Donald Trump’s first State of the Union address this week, with some citing his alleged reference to “shithole countries” several weeks ago as a pretext.

Trump denied making the remark, but Ugandan President Yoweri Museveni applauded him for speaking “frankly” about Africa’s “weaknesses.”

There is some merit to that argument. I have spent a good deal of time recently thinking about the lessons of my experience in South Africa — where I was born, and where I studied and worked for seven years after college.

It is a country straddling the First World and Third, not quite a “shithole” — rather beautiful, actually — but always, somehow, on the edge between success and failure.

For example, Cape Town, where I helped elect the first mayor to unseat the ruling African National Congress (ANC) in 2006, is suddenly on the verge of becoming the first major city in the world to run out of water. That is a rather “shithole” situation.

But it is also a relevant one, since those of us in California — living through another unusually dry winter — could find ourselves in a similar situation if we fail to plan ahead.

With that in mind, I offer nine simple rules to prevent any country from becoming a “shithole” — or to help those “shitholes” to become less so.

These are lessons drawn from my time as a student, freelance journalist, and speechwriter in South Africa, but they are worth keeping in mind in America, too.

1. Don’t just choose democracy. Choose liberal democracy. Dictatorships and one-party states tend to be poor. But democracy alone can be a disaster. You need a “liberal” system, in the classical sense — i.e. one that enshrines the rights of the individual and protects the political minority. South Africa, miraculously, chose the path of liberal democracy. Its political flaws today are traceable to those instances where it has bowed to simple majoritarianism. (In that vein, Republicans should think twice before ending the Senate filibuster, annoying as it is at the moment.)

2. Don’t fall for the illusion of “socioeconomic rights.” The American left loves the South African Constitution because of its generous guarantees of socioeconomic rights. But these are impossible to enforce. (Tell Cape Town how much the South African Constitution’s “right to sufficient food and water” means in the midst of a three-year drought.) They also degrade the value of other, fundamental rights, and enshrine statism as a governing philosophy. (Think about how Obamacare has violated religious freedom, and made government health care seem inevitable.)

3. The remedy for past racism is never more racism. South Africa has an aggressive affirmative action policy that has seen skilled whites leave the civil service and the country. The result, ironically, is black South Africans are worse off. The policy of “black economic empowerment” has hijacked the country’s scarce investment capital to create new billionaires, with little to show for it in term of jobs. Race-blind policies would have been better. (Have America’s affirmative action policies really helped uplift black people? Or have they created more racial division?)

4. The rule of law is fragile and irreplaceable. South Africa’s biggest challenge remains violent crime, which the ANC government has lacked the political will to confront. It also has trouble controlling illegal immigration from other African countries — and sees occasional flare-ups of xenophobic vigilante attacks. And official corruption is rampant. Neither South Africa’s beauty nor its many other advantages outweighs the decay of the rule of law. (This is the issue in America’s immigration debate: we are encouraging chaos by failing to enforce existing federal laws.)

5. Don’t waste time and energy attacking Israel. One of the things many “shithole” countries share is hatred for Israel. That is partly a legacy of Soviet patronage, or — in the Muslim world — ongoing conflict. But it also reflects a mindset that hates success. It would be far more useful for South Africa to learn from Israel’s achievements than to punish it for defending itself. Countries that reach out to Israel have tended to benefit as a result. (Luckily, the pro-Israel sentiments of the American people defied the anti-Israel policies of the previous administration.)

6. Expect the same of Muslims that you would expect of other citizens. Though it has some extremists, South Africa’s Muslim community lives peacefully within the broader society. One reason is that Islam — at least in the Cape — has a centuries-old, tolerant folk tradition that stands outside the tumult of the Arab world. Islam can be a positive, not a disruptive, presence when Muslims are expected to be as tolerant as all other citizens. (For all the criticism of Trump’s rhetoric, his approach will encourage Muslims to assimilate more successfully into America.)

7. Encourage political opposition to stand for something. Responsible opposition is crucial to the welfare of democracy, but it is a neglected political art. South Africa’s Tony Leon declined a position in the Cabinet of Nelson Mandela to build a political opposition party that could provide an alternative to the ANC’s quasi-socialism. South African democracy is stronger for his efforts. (Likewise, Republicans in the U.S. are learning from Donald Trump that they achieve more for America by fighting for their beliefs than by acquiescing to the Beltway and the media.)

8. Cultivate love among citizens, especially love of country. Despite all of South Africa’s challengers and dangers, many South Africans make incredible sacrifices for each other’s well-being, whether through charity or through volunteerism. That love of country persists in spite of racial, cultural, and language differences. When a country loses faith in its government, it can survive; when the people lose faith in each other, the nation dies. (This is the key to Donald Trump’s defenses of the flag and the anthem, which have resonated beyond Washington.)

9. What is more important than how you exercise power is how you give it up. Nelson Mandela could have been president for life, but stepped down after just one term. And for all of its flaws, the ANC did not unilaterally change the constitution when it had the two-thirds parliamentary majority to do so. Even mature democracies like the United States can learn from that example: not everything that is politically possible should be done. (For all his bluster, Trump has shown admirable deference to both the Constitution and the courts, unlike his predecessor.)

Joel B. Pollak is Senior Editor-at-Large at Breitbart News. He was named to Forward’s 50 “most influential” Jews in 2017. He is the co-author of How Trump Won: The Inside Story of a Revolution, is available from Regnery. Follow him on Twitter at @joelpollak.