President Trump’s new strategy for Afghanistan shows considerable reflection among the president and his top advisers on many military questions but deep confusion on the issues of “nation-building” and democracy.

The president’s August 21 speech illustrated the confusion. Take the signature lines: “We are not nation-building again. . . . We are killing terrorists. Our troops will fight to win. We will fight to win. From now on, victory will have a clear definition: attacking our enemies, obliterating ISIS, crushing al Qaeda, preventing the Taliban from taking over Afghanistan, and stopping mass terror attacks against America before they emerge.” And these: “We will no longer use American military might to construct democracies in faraway lands, or try to rebuild other countries in our own image. Those days are now over.”

First, it should be clear that those days are not just over, they never existed. The United States no more invaded Iraq and Afghanistan to “construct democracy” than we invaded Germany and Japan in the 1940s for that purpose. But our leaders concluded after the Second World War that the domestic order in those places affected our own security. Fascist Japan and Germany were enemies; democratic Japan and Germany would be allies, we thought, and we were right. The conditions in Iraq and Afghanistan would determine whether they became enemy states, dangerous ungoverned spaces that harbored terrorist groups like al Qaeda and ISIS, or were able to control their own territories in alliance with the United States.

There was a hint of this in the president’s speech when he said that “it is up to the people of Afghanistan to take ownership of their future, to govern their society, and to achieve an everlasting peace” and then that “the government of Afghanistan must carry their share of the military, political, and economic burden. The American people expect to see real reforms, real progress, and real results.” But what political burden does the Afghan government carry? What reforms do we demand?

What’s entirely missing in the new policy is an understanding that Islamist extremist groups have not just guns but ideas—what the president called an “evil ideology.” To defeat their guns, our own military efforts in support of local police and military operations are necessary—and here the president was quite right to continue and expand those efforts. But policemen and soldiers cannot provide the ideas that are needed to defeat Islamist extremism. Put another way, the president’s emphasis on “killing terrorists” is right, but he has overlooked the other half of the necessary formula: preventing those who are killed from being replaced by new armies of extremism. He did at one point say we will “dry up their recruitment,” but he did not say how we plan to do this throughout the Muslim world.

This is not an abstract or intellectual problem. Take the example of Egypt. Presumably there is rejoicing in official Cairo over the president’s apparent abandonment of any effort by the United States to “rebuild other countries in our own image.” To the Egyptian regime, that must mean that it will hear no complaints about human rights violations. But there are up to 60,000 political prisoners in Egypt’s jails—people who have not yet been tried on any charge or who have been tried and jailed for peaceful protests. In those jails they face abuse and torture at the hands of a regime they must increasingly see as deeply unjust, while they are surrounded by jihadist prisoners who are the genuine article—Islamist extremists with ideas and theories of what is wrong with Egypt and how to fix it. What will emerge from those jails is more extremists and more terrorists. The Egyptian government has a magic elixir here that can turn peaceful protesters into jihadists.

An American policy that is indifferent to this is not a practical or realistic formula for defeating terrorism. As we have seen with al Qaeda, one group can be brought low only to be replaced by another, like ISIS, or to bounce back itself; and as we have seen in Syria, killing jihadists doesn’t “win” a war if there are endless supplies of replacements ready to travel to those battlefields.

The president said that “we will not dictate to the Afghan people how to live, or how to govern their own complex society” and added, “We are not asking others to change their way of life, but to pursue common goals that allow our children to live better and safer lives.” The straw man here is obvious: We must stop trying to make Afghanistan look like, say, Connecticut! I would have thought that Gens. Mattis, Kelly, and McMaster might have disabused the president of the notion that this was ever the American goal in the Middle East or South Asia, any more than it was our goal in postwar Europe. Our goal has been far more pragmatic: to promote domestic political arrangements that will be stable and will be successful in controlling territory and preventing the rise of violent groups that can threaten the United States and our allies.

Anyone, including the president and his advisers, who thinks all of that can be achieved without the slightest concern for the domestic political arrangements—vicious tyranny or benign rule, brutal repression or a decent respect for human rights, regimes that rule only by force or governments that are legitimate in the eyes of their population—is repeating a formula that failed us repeatedly in the Middle East, helped lead to the current crisis, and will eventually produce more terrorism.

The president said in his speech that we must continue our efforts in Afghanistan. He seemed to realize that we won’t be able to get out safely until the government and people of that country are willing and able to fight terrorism successfully: the “real reforms, real progress, and real results” of which he spoke. Does that sound a bit like the dreaded “nation-building?” Call it what you will, denounce it, even revile it, the conclusion remains: Domestic political arrangements and political legitimacy affect the struggle against extremism. If the president wants to pursue a policy of what he called “principled realism,” he will need to acknowledge that fact.

Elliott Abrams is senior fellow for Middle Eastern Studies at the Council on Foreign Relations. His new book Realism and Democracy: American Foreign Policy After the Arab Spring will be published by Cambridge University Press next month.