The United States is fighting for the soul of its democracy. While the hateful agenda of Donald Trump was dealt a rebuke in the midterm elections, in a deeply polarized country, the struggle for democracy will only intensify as Trump and his allies attempt to pull America down a dangerous path.

The president spouts racist conspiracy theories – which have been used as justification for the mass slaughter of Jews in a synagogue and which appear to have inspired the attempted assassination of Democratic party leaders – with impunity. The president said the US military should shoot at asylum-seeking refugees at the southern border. He attacks the media as the “enemy of the people”. And all this was just in the past month.

But the United States isn’t alone – democracies across the world are struggling for their survival. Hungarian president Viktor Orban has launched systematic attacks on his country’s democratic institutions. President Rodrigo Duterte of the Philippines has led a campaign of extrajudicial killings of drug users and sellers. Brazil elected as president Jair Bolsonaro, who has defended Brazil’s former dictatorship and espouses hate against women, the LGBTQ community, and others. Whether driven by nationalism, racism, fear of immigration, or other forces, populist movements can be contagious.

This should not be surprising, as political transitions can happen in waves. The “third wave” of democratization swept across Latin America, Europe, Africa and Asia in the 1970s, 1980s and 1990s, and in 2011 a rapid succession of popular rebellions erupted across the Middle East.

Democracies and autocracies learn from one another. In the wake of the murders at a Pittsburgh synagogue, China’s state-run media suggested that the United States employ “anti-extremism education” like that China is using in Xinjiang, where it imprisons roughly a million Uighurs just because of their religion. When Nigeria’s military recently killed protesters who had been accused of throwing rocks, the Nigerian military cited Trump’s comments that the US military could shoot refugees at the southern US border if they threw rocks.

While the United States struggles to revitalize its own democracy, it cannot ignore this global trend of democratic backsliding. To paraphrase Martin Luther King Jr., a threat to democracy anywhere is a threat to democracy everywhere. The last time America ignored massive democratic backsliding abroad, the second world war exploded and dragged America into its horrors.

Though it cannot begin in earnest until Trump leaves office, America must adopt a new foreign policy focused on defending and expanding the ranks of democracies around the world. This will require re-orienting assistance to democracies, finding more effective ways to support democratic movements abroad, and other efforts such as those outlined in a new report by me and my colleagues at the Center for American Progress. And since the notion of “democracy promotion” has been confused with the Iraq war and regime change, let’s be clear: This policy is not about transforming autocracies into democracies, fostering violent revolutions, or imposing democracy by force; it is about helping democracies succeed and pushing back against autocratic encroachments on democracy.

To paraphrase Martin Luther King, a threat to democracy anywhere is a threat to democracy everywhere

At the core of this effort must be building a robust infrastructure for democracies to unite to protect their own democratic systems and push back against autocracy. The skeleton of this system already exists: The European Union is built on democratic principles; the G7 knits together some of the world’s richest democracies to tackle challenges such as poverty and climate change; and the Community of Democracies (CD) convenes democracies to share lessons learned about strengthening democracy.

Today, the United States must lead a global effort to stitch together the best parts of these structures into a robust democracy organization. The CD could serve as the home, with three main goals:

First, enable democracies to share lessons and provide technical support to one another to strengthen democratic institutions. Democracies must learn from one another to overcome challenges such as how to balance free expression with hate speech and disinformation.

The CD already provides this platform, and with a reformed membership that meets at the head of state level every year it could expand its efforts.

Second, develop common approaches to strategic issues. The threats are significant: Russia invaded a neighboring state struggling with democracy and threatens others; China is bullying neighbors in Asia. Russia and China frequently prevent United Nations action on issues related to democracy and human rights, and so democracies must band together to coordinate their own pushback against Russia, China, and others when international norms and democracy are threatened.

Third, coordinate responses against attempts by autocracies to sow discord in democracies. Russia attacked America in an attempt to sway the 2016 presidential election to Trump, and it uses similar tactics to influence politics across Europe. China is now looking to export its own “digital authoritarianism” to equip other states with the technology to repress their peoples. Democracies must work together to understand how these threats impact them and develop strategies for defending themselves and fighting back.

Supporting democracy abroad, of course, is not new. But today, the need is as great as ever. This will be a generational effort. One or two elections at home or abroad will not signal victory or defeat. And for America, it will hinge in part on whether or not America can emerge from its current struggles as a stronger democracy. But for democracy to survive, democracies around the world must band together.