Just days before the first Democratic presidential debate, Bernie Sanders is taking on America’s “endless wars.”

In a new op-ed for Foreign Affairs, the Vermont senator and 2020 candidate lays out a vision for extricating the United States from wars in the broader Middle East and reorienting America’s foreign policy so that it “privileges diplomacy and working collectively with allies” over unilateral military action to tackle security concerns.

As part of that, Sanders commits to pulling out of the war in Afghanistan, which has persisted for almost 18 years without a resolution. “Withdrawing from Afghanistan is something we must do,” he writes.

He doesn’t go into much detail about his diplomatic or political strategy for accomplishing that, though. And he neglects to mention that the Trump administration has been trying to negotiate a peace deal with the Taliban to try to finally end the ongoing conflict.

But Sanders’s stance on Afghanistan fits into his larger argument, which is that the Bush administration’s decision to launch the “war on terror” led successive administrations — including, he implies, the Trump administration — to see countering terrorism with US military force as the guiding principle of US foreign policy and national security.

Sanders argues that this approach has wasted billions in taxpayer dollars and consumed America’s attention, allowing competitors such as Russia and China to exploit the “forever wars” and expand their political influence. And through it all, he says, the “endless wars” failed to achieve their objectives.

In one sense, Sanders’s foreign policy vision sounds a little like Trump’s. After all, Trump campaigned in 2016 on an “America First” policy that pledged to end US involvement in pointless wars in the Middle East and elsewhere and instead invest that money in rebuilding America’s economy.

And Trump’s 2017 National Security Strategy explicitly focuses on strategic threats from competitors like China and Russia and calls on US allies and partners to help share the burden of combating terrorism.

But Sanders’s vision diverges from Trump’s in several important ways. For one, Sanders identifies fighting climate change and global inequality as key security threats on par with Russia and China. He also directly ties the obsessive focus on terrorism to the current immigration crisis:

By turning our immigration debate into a debate about Americans’ personal security, we have conflated one policy conundrum with another and subjected all those who seek a better life in the United States to xenophobia and defamation. There is a straight line from the decision to reorient U.S. national-security strategy around terrorism after 9/11 to placing migrant children in cages on our southern border.

Most explicitly, Sanders uses the current standoff with Iran to contrast his foreign policy outlook with Trump’s. “I am very concerned that, whether intentionally or unintentionally, the Trump administration’s moves against Iran, and Iran’s moves in response, could put us in direct conflict,” he writes. “We need to take a step back and rethink what we are doing, both in Iran and in the broader Middle East.”

Sanders is not exactly arguing for a US retreat from the world stage; he’s advocating for diplomacy over force, and for cooperation over unilateralism. His stance also doesn’t rule out using the military; it just advocates that it not be the primary or default option. And this is where Sanders’s plan is pretty much the opposite of Trump’s “America First” worldview, as it envisions America leading within institutions and partnerships rather than going it alone.

“American power should be measured not by our ability to blow things up, but by our ability to build on our common humanity, harnessing our technology and enormous wealth to create a better life for all people,” Sanders writes.

Sanders’s foreign policy vision keeps taking shape

Sanders’s lack of foreign policy experience was seen as one of his weaker spots during the 2016 presidential campaign. Sanders has since burnished his foreign policy credentials, most notably through his efforts to end the US’s involvement in the Saudi-led war in Yemen.

He led bipartisan efforts to pass a War Powers Resolution to end the Trump administration’s support for the Saudi-led coalition’s war efforts — support that never received congressional approval. Though that resolution passed both the House and Senate, Trump vetoed it.

But as Vox’s Tara Golshan has written, Sanders’s opposition to the Yemen war “fits so perfectly within his worldview that to listen to him explain it, you can hear the echoes of his famed speeches about millionaires and billionaires on Wall Street.”

Sanders’s latest op-ed echoes this worldview too. He wants to dial back military intervention and rethink America’s “militaristic approach.” He’s promoting diplomacy and foreign aid as substitutes for force. And he sees America’s military commitments as leaving unattended other pressing problems on a domestic and global scale, such as inequality.

Some have argued that Sanders, and other candidates such as Sen. Elizabeth Warren (D-MA), are reimagining a “progressive” foreign policy that focuses less on national security and more on tackling the root causes of international conflict, such as inequality.

But overall, 2020 Democrats are still forging coherent foreign policies. Domestic issues like health care have tended to dominate the debate so far. And the left has grappled with how to deal with its own role in America’s “endless wars” and the inertia that tends to prevail in US foreign policy.

While in office, President Barack Obama, who had campaigned on ending the Iraq War, continued the war in Afghanistan, sent US troops to Iraq and Syria to fight ISIS, and expanded the US’s covert war on terror with drone strikes. He is also the president who began the support for the Saudi war effort in Yemen that continues to this day.

Sanders, then, is trying to break with both past Democratic and Republican administrations. But the hard part will be figuring out the details of how to implement his foreign policy approach. Wanting to end endless wars is one thing; actually doing it is another.

Read Sanders’s full op-ed in Foreign Affairs.