A portrait of Shifa Gardi, an Iraqi journalist who was killed while covering the Mosul offensive, is shown at the offices of the Kurdish-language TV network Rudaw in Irbil, Iraq. (Safin Hamed/Agence France-Presse via Getty Images)

By all accounts, Kurdish journalist Shifa Gardi was a remarkable talent. She often reported from the front lines of the war against the Islamic State, her courage and audacity making her enormously popular with viewers on the Kurdish-language TV network Rudaw, based in northern Iraq.

On Feb. 25, her luck ran out. As she was covering the fighting in Mosul, a roadside bomb planted by the Islamic State exploded, killing her and wounding the cameraman who was traveling with her. Gardi was just 30. It’s a terrible loss not just for the Kurds of northern Iraq but also for the future of journalism in the Middle East. Gardi, like most Kurds, was a Muslim, but she reported without covering her head and strove to uphold professional standards of journalism in a part of the world where that is usually an uphill battle. “She was a sweetheart and a great journalist,” Rebaz Ali, one of her colleagues, told me. “She was a model for many young women in Kurdistan.”

In short, Gardi was just the sort of ally the West should be cultivating in its fight against the global jihadist threat. Her whole life refuted the notion that the Muslim world is a monolith, uniformly hostile to the values we hold dear. Yet under the first version of President Trump’s notorious travel ban, Gardi would have been barred from entering the United States — because she was a citizen of Iraq, one of the seven countries originally targeted in the ban.

Trump has now decided to right this wrong. He has issued a new version of the executive order that will exempt Iraqis from the restrictions. Apparently the president has heeded the voices of reason in the Pentagon and the State Department (and, one might hope, The Post’s editorial board), who made it clear to him that Iraq is one of our most important allies in the international war against the forces of “radical Islamic terrorism” (as Trump likes to call it). Evidently they convinced him — as so many journalists have been pointing out — that slighting Iraqis with this sort of ill-considered move was a gift to the Islamic State.

So kudos to the president. In this particular case, he has shown that he’s capable of learning. Let’s hope this is the start of a trend, even if the scaled-down version of the ban remains problematic for a whole host of by-now-familiar reasons.

But let’s not dwell on that for the moment. Let’s move to another point: what this latest decision implies about Trump’s larger view of the world.

The decision to modify the original travel ban to accommodate a crucial regional ally is an admission that we need Muslims on our side to fight the jihadist threat. The current government in Baghdad, while assisted by members of the international coalition led by the United States, has borne the brunt of the offensive to retake Mosul, which is Iraq’s second-largest city. Iraqi forces have so far lost hundreds of lives and thousands have been wounded in their campaign to eject the Islamic State from the city.

There’s no question that Iraqis, including the Kurds, have been doing this to serve their national interests (and in some cases, to take revenge for the atrocities visited upon their families by the Islamic State). But as the largest and most effective force on the ground in the fight, they’ve also been working on our behalf —  which is why we’ve been supporting them with intelligence, air power and even artillery.

One wonders, however, what some of Trump’s chief advisers think about all this — and particularly the lifting of the ban on Iraqi visitors. Stephen K. Bannon, one of Trump’s most influential aides, has repeatedly aired the idea that Western civilization is locked in “a global existential war” with the Islamic world, one with roots in centuries of conflict. Stephen Miller, who is said to have helped in formulating the original text of Trump’s travel ban, spent his college years touting events on the dangers of “Islamofascism.”

And then there’s Sebastian Gorka, the controversial academic, now a deputy assistant to the president, who has made a career out of insisting that the Koran predisposes some Muslim believers to terrorism. “Anybody who downplays the role of religious ideology… they are deleting reality to fit their own world,” he told The Post’s Greg Jaffe in a recent interview. Gorka suggested that the United States should ally itself with “secular” regimes through the Muslim world, singling out Egypt, Jordan and the United Arab Emirates. Yet Gorka also recently made headlines by refusing to answer when asked whether Trump believes that Islam is a religion — an awfully strange way to make friends and influence people in the Islamic world (“secular” or not).

None of this sounds as though Trump’s entourage is particularly concerned about cultivating friends among the world’s 1.6 billion Muslims. Yet cultivate friends we must, as the current war in Iraq so vividly demonstrates. Unless we want to start sending out huge new armies of occupation to the Middle East, we will have to go on building our relationships with a range of Islamic governments — some of them, indeed, not necessarily “secular.” (The Iraqi government, which we helped to create by toppling Saddam Hussein, is dominated by religious Shiites, some of them uncomfortably close to Iran.)

Along the way, we should also do whatever we can to support religious tolerance and political pluralism as part of that engagement. Islam is not at war with the “West,” but it is definitely at war with itself, and we should do what we can to bolster the forces of moderation wherever they exist.

If we succumb to the myth of a monolithic Islam bent on the destruction of the West, we will only end up strengthening the most backward-looking forces on both sides of the divide. That would be a terrible tragedy. It’s people like Shifa Gardi who stand for an entirely different version of the future of the Middle East. They’re the ones we should side with.