CNN national security analyst Juliette Kayyem is the author of "Security Mom: An Unclassified Guide to Protecting Our Homeland and Your Home." She is a professor at Harvard's Kennedy School, a former assistant secretary of Homeland Security in the Obama administration and founder of Kayyem Solutions, a security consulting firm. The opinions expressed in this commentary are hers.

(CNN) While President Trump stumbles along with his executive order (now blocked by a federal appeals court) banning immigration from seven countries, an important reality has been lost in the international criticism and legal analysis: not all seven countries named in the ban are alike.

They are not all enemies of the US -- like Iran -- or nations we have been at war with -- like Iraq or Afghanistan. In fact one of them this week provided a clear example of the perilous geopolitical territory the Trump administration wandered into when its ban not only resulted in confusion, but delivered a serious blow to counterterrorism efforts that help keep America safe.

I'm referring here to Yemen.

In a 24-hour period late last month, Yemen was the focus of not one, but two, important efforts by the Trump administration. On a Friday, the ban was imposed against Yemen. A day later, Trump authorized a raid by special forces to capture the leader of Al Qaeda in the Arabian Peninsula, Qassim al-Rimi, that resulted in the death of a US Navy SEAL, 13 civilians (according to Yemeni officials) including an 8-year-old gir l and the downing of an Osprey aircraft. The Pentagon said 14 al Qaeda fighters were killed in the battle.

JUST WATCHED Military botches Yemen raid video release Replay More Videos ... MUST WATCH Military botches Yemen raid video release 02:01

For years during the Bush and Obama administrations, Yemen had cooperated with US efforts, which included drones and ground raids, well aware that many areas in its country were being used by terrorists to train and hide. It never required specific approval, which would have delayed US missions and potentially risked their secrecy.

Yemen's public skepticism and the unclear status of what a "reassessment" actually is present a major impediment to our counterterrorism efforts. In nations like Yemen, with major geographic areas that are essentially failed states, the coalition efforts rely on the host country to allow it to come in and fight terror. That is not an easy agreement for a country like Yemen: it has to deal with internal forces that do not view the United States as a force of good.

The careless mission, coupled with the "in your face" naming in the executive order, were unsustainable affronts to Yemen and it responded in kind. Yemen is not a democratic nation and it is a human rights violator. It is not a friend, in the sense of how Americans view Great Britain or France as friends. But it isn't a foe either.

JUST WATCHED Yemen raid planned under Obama, approved by Trump Replay More Videos ... MUST WATCH Yemen raid planned under Obama, approved by Trump 03:00

This represents the quintessential challenge of the emerging Trump Doctrine. The President views foreign relations in a binary fashion: nations are good or bad. The world is a little more complicated. Mexico isn't just about a wall, for example; it is a major trading partner. Australia isn't just about a refugee dispute; it is a major ally in our war efforts. Yemen isn't just a state that harbors terrorists; it is a partner in a global mission.

In domestic circles, the debate about whether the now-stalled executive order is good or bad for counterterrorism efforts is being litigated in courts and public opinion. But for Yemen, the inclusion was a blow to a historic expectation that the nations -- for better or for worse, in the gray area or not -- would fight together.

President Trump has said that rescinding the executive order would put our nation at risk. That statement is questionable but clearly a political tactic.

The failed al Qaeda mission and Yemen's response will hinder our ability to engage fully in targeted military efforts to protect our nation in the global war on terror. With friends like us, Yemen found it necessary to reset the relationship.