BAGHDAD — Capt. Ahmed Adnan al-Musawe had survived another day battling Islamic State fighters in Mosul last weekend when he heard startling news: The new American president had temporarily barred Iraqis from entering the United States and wanted tougher vetting.

Captain Musawe, who commands an infantry unit of the Iraqi Army’s elite counterterrorism force, considers himself already fully vetted: He has been trained by American officers in Iraq and in Jordan. And backed by American advisers, he has fought the Islamic State in three Iraqi cities, including three months of brutal street combat in Mosul.

“If America doesn’t want Iraqis because we are all terrorists, then America should send its sons back to Iraq to fight the terrorists themselves,” Captain Musawe told a New York Times reporter who was with him this week at his barricaded position inside Mosul.

President Trump’s Jan. 27 executive order has driven a wedge between many Iraqi soldiers and their American allies. Officers and enlisted men interviewed on the front lines in Mosul said they interpreted the order as an affront — not only to them but also to fellow soldiers who have died in the battle for Mosul.