Now that Donald Trump is officially its commander-in-chief, America’s foreign allies are being forced to grapple with a highly sensitive question: Is it still safe to share information with U.S. intelligence agencies?

The global spy community — a fractious world where friends, frenemies and sometimes enemies often enter alliances of convenience — always holds its breath when a new U.S. president takes office. But Trump is an anomaly even for a group used to strange things. The new president, who visited the CIA headquarters on Saturday, has spent weeks insulting the intelligence agencies he now oversees. He also has pushed for warmer ties with Russia, a country that several European states view as a dangerous aggressor, and which U.S. intelligence officials have had difficulty coordinating with in the past.

As a result, U.S. officials and analysts fear other countries will hesitate to share information with a Kremlin-friendly Trump administration. Trump’s off-the-cuff communication style also alarms observers in the U.S. and abroad who worry he may, inadvertently or out of bravado, reveal classified information. Another concern: Trump is so obviously distrustful of U.S. intelligence agencies that he may ignore their advice, making other nations feel it is not worth the effort to clue in the Americans.

“If there’s a sense that we’re cozying up to regimes like Vladimir Putin’s Russia, that could have something of a chilling effect," said a senior official from former President Barack Obama’s administration. "The challenge may be in places like Germany, France, potentially even the United Kingdom. If there is a reorientation toward Moscow, there could be some doubts there.”

John Brennan, who submitted his resignation as CIA director this past week, has also voiced concerns. “I think the world is watching now what Mr. Trump says, and listening very carefully,” Brennan told Fox News in a mid-January interview.“If he doesn't have confidence in the intelligence community, what signal does that send to our partners and allies, as well as our adversaries?”

“There is huge implicit trust between U.S. and British agencies, for example, that will not be easily undermined" -- Senior European security official

Current and former European officials contacted by POLITICO were cautious in their comments, noting that it is still too soon to tell how Trump will act as president. Some, however, hinted at the possibility of shifts in intelligence sharing under Trump. One suggested it could come down to what their U.S. counterparts communicate with them about how they think the president is doing.

"Most European services will be influenced in their approach by whatever assessment and reassurances their U.S. counterparts give about the trustworthiness of the new administration,” a senior European security official said. “There is huge implicit trust between U.S. and British agencies, for example, that will not be easily undermined even by the arrival of a new president with unknown qualities.”

For all their famed prowess, American spy agencies rely a great deal on foreign intelligence partners for help on everything from counter-terrorism to cybersecurity. Such relationships are especially vital in regions where language and cultural barriers are high. Figuring out what’s happening in North Korea, for instance, is much easier done with the help of South Korea’s intelligence sector.

Some of America’s intelligence partnerships, such as the one with Britain, stretch back decades and are highly structured arrangements. But few countries share intelligence out of pure altruism, and some do so under tremendous pressure, such as Pakistan did in the wake of the Sept. 11, 2001, attacks. In some cases, countries that aren’t necessarily U.S. allies will cooperate with the Americans for a variety of reasons, but they may not want their cooperation publicized.

In July 2007, Thomas Sanderson, a senior fellow at the Washington-based Center for Strategic and International Studies, found himself face-to-face with Syrian President Bashar Assad in Damascus. This was back when the Arab leader was seen by some Westerners as a potential reformer, and well before he became the central figure in a bloody civil war that has drawn in Russia and Iran.

Sanderson asked Assad why his government stopped its earlier cooperation with U.S. intelligence agencies, despite having become a key partner in the hunt for Al-Qaeda fighters following the 9/11 attacks. Assad claimed his government was upset because the George W. Bush administration had leaked word of the U.S.-Syrian intelligence cooperation to the press, apparently to help gain legitimacy for the invasion of Iraq. The White House leaks made Syria seem like an American proxy, and turned it into a target for the jihadists, Assad said, according to Sanderson’s recollection.

Assad may have been bluffing about his true motives. According to the Bush administration, Syria was a less-than-helpful partner, barely even pretending to crack down on militants trying to reach Iraq to fight U.S. troops, and Sanderson noted that the U.S. said it had ended the partnership for that reason. Still, the exchange underscored the extreme sensitivities involved in U.S. intelligence sharing with foreign countries and the damage that can come about when one side decides it can no longer trust the other.

“While intelligence sharing relationships with our friends and allies are important, they cannot replace our own unilateral recruiting and operations” -- Republican congressman Mike Pompeo

It’s a lesson Trump must quickly learn, Sanderson said.

“Our allies — or other intelligence partners — don’t want their sources and methods exposed, and they may not want their own cooperation exposed when they feel like Trump will ignore the intelligence or even criticize it,” Sanderson said. “Trump does not have the sophistication nor does he exhibit the respect for the intelligence community to give me or other people confidence that he won’t make a mistake like that.”

Trump aides did not immediately respond to a request for comment.

But Mike Pompeo, the Republican congressman from Kansas whom Trump has nominated to serve as CIA director, nodded to the need for continuing ties abroad during his Senate confirmation hearing earlier this month, calling foreign governments “vital partners.” However, Pompeo also stressed that the United States must be able to stand on its own.

“While intelligence sharing relationships with our friends and allies are important, they cannot replace our own unilateral recruiting and operations,” he said.

One upside for foreign countries worried about intelligence sharing under Trump is that there are relatively few politically appointed officials at agencies such as the CIA or the NSA. The vast majority of the U.S. interlocutors who deal with foreign intelligence agencies are career employees who do not leave with the launch of a new presidential administration, thus providing continuity and enhancing the level of trust.

As president, however, Trump can set the broad policy agenda for the intelligence world, and if he says he wants the U.S. to cooperate more with Russia, the agencies will have to obey, even if past attempts at such an alliance have been rocky.

Trump has repeatedly flattered Putin while largely resisting U.S. intelligence assessments that the Kremlin interfered in the 2016 election to help Trump win. At one point, Trump used a Nazi Germany reference when he blamed U.S. intelligence agencies for leaks about a private dossier allegedly containing compromising information Russia had obtained on him. (U.S. intelligence officials denied their agencies leaked anything.)

“You can’t go to the Europeans and say ‘Relax guys, we’re going to try to improve things with the Russians and it won’t impact you.’ They know better” -- Steven Hall, former CIA head of Russian operations

Trump and some of his top aides, including National Security Adviser Michael Flynn, have indicated that the U.S. should lay aside its anger with Russia over its invasion of Ukraine and its backing of the Assad regime in blood-soaked Syria. Instead, they argue, the U.S. should work with Moscow to fight Islamist extremists, a threat they consider far more serious than Russian expansionism.

The rivalry between American and Russian (or Soviet) intelligence agencies is the stuff of books and movies. But the two sides have at times cooperated, including on counter-terrorism immediately after 9/11 and on security-related issues in the run-up to the 2014 Winter Olympics in the Russian city of Sochi. The results, however, have always been mixed at best, as neither side ever really trusted the other, former intelligence officials said.

“The Russians think it’s quite quaint when we come to them and say, 'Well, sir, of course we want to cooperate with you,’ but there are so many times they’ve manipulated and lied to us,” said Steven Hall, a former CIA head of Russian operations who retired from the agency in 2015.

After the 9/11 attacks, the Russians appeared eager to cooperate with the U.S. on battling terrorist groups. The problem, Hall said, was that the Russians only really cared about some terrorist organizations.

“What we were at the time referring to as the global war on terrorism, the Russians thought of as the global war on Chechnya,” Hall said, referring to the restive region Putin has sought to pacify. “We were caught in a weird position, because we were like, we’ve been told to cooperate with these guys. And they wanted our intelligence on Chechnya, but then they would go and raze an entire village! It didn’t end well.”

European countries, especially the Baltics and other former Soviet states, will not see Russia through the same rose-colored lenses as Trump, Hall and others warned. Many European allies are still rattled by Obama-era reports, courtesy of National Security Agency leaker Edward Snowden, that U.S. agencies had been monitoring their leaders’ phone calls and otherwise spying on them — an episode that was a blow to intelligence cooperation.

With Trump, countries such as Germany will worry that anything they share with the new U.S. administration might somehow find its way to Moscow.

“You can’t go to the Europeans and say ‘Relax guys, we’re going to try to improve things with the Russians and it won’t impact you.’ They know better,” Hall said.

If Trump and his aides press forth with their pro-Kremlin stance, the U.S. may lose some partners on intelligence sharing, but it could also strengthen links with others. Italy, for instance, has a better relationship with Moscow than, say, the Baltics, and could find itself a newly prized partner, said Leonardo Tricarico, president of the Rome-based Intelligence Culture and Strategic Analysis Foundation.

If Trump downplays or dismisses what the CIA and other agencies tell him, that could erode allies’ confidence.

Michael Hayden, who led both the NSA and the CIA under the George W. Bush administration, said one reason other countries were willing to share intelligence with the United States was that it often has the capacity and willingness to act on the information. But if Trump downplays or dismisses what the CIA and other agencies tell him, that could erode allies’ confidence.

“How many foreign intelligence agencies might say, ‘I’m not sure giving this information to the Americans will do any good anyway. So why should we share it in the first place?’” Hayden asked. “If they come to the conclusion that the decision-makers don’t pay attention to the intelligence and the intelligence community is not respected, then why take the risk?”

Giulia Paravicini, Jacopo Barigazzi, and Nicholas Vinocur contributed to this report.