David S. Cohen served as deputy director of the Central Intelligence Agency and undersecretary of the Treasury for terrorism and financial intelligence during the Obama administration.

The relationship between the intelligence community and President Trump surely has been tested in the first six months of this administration. But the president’s reported demand for intelligence to support his policy preference to withdraw from the Iran nuclear deal risks politicizing intelligence analysis, with potentially grave consequences not only for national security decision-making but also for our ability to address a wide range of international threats.

Under a 2015 law governing the Iran nuclear agreement, the president is required to certify every 90 days whether Iran “is transparently, verifiably, and fully implementing the agreement,” “has not committed a material breach with respect to the agreement,” and “has not taken any action, including covert activities, that could significantly advance its nuclear weapons program.”

Although this certification is a political call, it necessarily is based on an intelligence assessment. Intelligence analysts, who are privy to our clandestine collection as well as the intelligence shared with us by key liaison intelligence services, and who are trained in applying proper analytic tradecraft, are in the best position to judge whether Iran is spinning too many centrifuges, holds too much enriched uranium or is secretly pursuing a nuclear weapon.

Trump apparently understands this. Acting on the recommendation of his key national security advisers — the secretary of state, secretary of defense, national security adviser and chairman of the Joint Chiefs of Staff — he reluctantly agreed last month to certify that Iran was in compliance with the agreement. That uniform recommendation, of course, was based on the intelligence community’s collection and analysis.

But Trump then immediately commissioned a group of White House aides to generate a rationale for declaring Iran to be in violation of the agreement. According to a report in Foreign Policy, this group includes Stephen K. Bannon, the president’s chief strategist, who has no intelligence background. The president reportedly told them “that he wants to be in a place to decertify 90 days from now and it’s their job to put him there,” according to the magazine’s source.

This is not how the intelligence process is supposed to work. Certainly, policymakers should ask the intelligence community probing questions and challenge the community’s judgments. That not only is policymakers’ prerogative, but also it is the right thing to do, and the tougher and more topical the questions, the better.

But there is a big difference between asking a pointed question and demanding a particular answer. When a president directs his staff to generate intelligence to support a preferred policy outcome, overriding the dispassionate analytic judgments of intelligence professionals, that is the very definition of politicization of intelligence.

This is a dangerous place to go. At the most basic level, one would hope that foreign policy decisions with potentially dramatic consequences would be based on the best available facts, not political pretexts.

That is one reason we have invested billions of dollars in our intelligence community over the past decades. Not only is the U.S. intelligence community unparalleled in its collection capabilities, we also have devoted enormous time and attention to training our analysts — especially in the aftermath of the episode regarding weapons of mass destruction in Iraq — to ensure that finished intelligence is objective, properly qualified, based on all available sources and free of political considerations. When the president demands intelligence to fit his political desires, this investment is squandered and our national security endangered.

Moreover, politicized intelligence undermines our ability to generate international support for steps — military, diplomatic, economic or otherwise — the administration may want to take in coordination with others.

When our allies, not to mention our frenemies, doubt the validity of U.S. intelligence claims, they are much less likely to work with us. When I traveled the world to build support for sanctions on Iran by presenting intelligence (with authorization, of course) on the progress of Iran’s nuclear program, the hangover from the Iraq intelligence failure was palpable. But because our intelligence on Iran was unquestionably sound, we were able to persuade dozens of countries to work with us in pressuring Iran.

If Trump withdraws from the Iran nuclear deal based on intelligence viewed as politicized, there would be little hope that our European allies, not to mention the Russians and Chinese, would cooperate in reimposing sanctions, much less join us in military action.

And the harm would not stop there. Our diplomats and other officials rely on the strength and authority of our intelligence analysis every day in forming policy, in bilateral negotiations and in bringing together coalitions around the world. Weakening this foundation by politicizing the intelligence process would make it more difficult to address a range of national security challenges, from North Korea to Syria to Venezuela.

The president recently told the Wall Street Journal that he expects the “detailed studies” he has commissioned to validate his belief that Iran is “noncompliant.” It is up to the leadership of the intelligence community to ensure that the president’s political desires do not infect the intelligence analysis and that their officers remain able to speak truth to power.