CNN  — 

Secretary of State Mike Pompeo made an unannounced trip to Iraq on Tuesday after abruptly canceling a planned trip to Berlin amid escalating tensions with Iran.

The top US diplomat met with Prime Minister Adil Abd al-Mahdi, President Barham Salih and other officials while on the ground in the Iraqi capital in a roughly four-hour visit, according to the pool traveling with Pompeo.

Pompeo described his meetings as “productive” and said he spoke to the officials “about the importance of Iraq ensuring that it’s able to adequately protect Americans in their country.”

“They both provided assurances that they understood that was their responsibility,” he said.

He also said that the US “wanted to let them know about the increased threat stream that we had seen and give them a little bit more background on that so they could ensure that they were doing all they could to provide protection for our team.”

“They understood too it’s important for their country. We don’t want anyone interfering in their country, certainly not by attacking another nation inside of Iraq and there was complete agreement,” Pompeo said.

US officials have told CNN the US had “specific and credible” intelligence that suggested Iranian forces and proxies were planning to target US forces in locations including Iraq. That intelligence led the Pentagon to recommend a carrier strike group be moved to the region. Speaking to the press pool following his visit, Pompeo reiterated that it was the US’ understanding that “these were attacks that were imminent, these were attacks that were going to happen fairly soon, we’ve learned about them and we’re taking every action to deter them.”

Prior to his arrival in Baghdad, Pompeo declined to go into details when asked to elaborate further on the “tipping point” for his abrupt change of travel plans

Pompeo said he had informed President Donald Trump of his travels on Monday night and that the President had asked him to pass along a number of messages.

“The central messages are this: We want to make sure that Iraq is positioned so that the relationship that we’ve built with them and that our allies in the region have built with them – allies that range all across the Gulf, who understand that the primary threat in the Middle East is Iran – remains strong, that those relationships remain strong,” he said.

The US secretary of state said he and officials discussed how to defeat the remaining pockets of ISIS in the country and foreign terrorist fighters being held in detention camps. Although Pompeo indicated prior to his stop that he would discuss “big energy deals that can disconnect (Iraq) from Iranian energy,” he said afterward that although they spoke about energy infrastructure, they “didn’t spend much time talking about sanctions issues.”

Pompeo abruptly canceled a scheduled trip to Germany earlier on Tuesday “due to pressing issues,” the State Department said. The secretary of state told the pool prior to landing in Iraq that Germany’s foreign minister, Heiko Maas, understood the decision to cancel.

Pompeo’s trip to Iraq came amid news that Iran plans to announce it will reduce its commitments to the Joint Comprehensive Plan of Action (JCPOA) – one year after the US announced its departure from the landmark nuclear deal.

“Iran exercised restraint over the past year, but the other parties to the deal failed to adhere to their commitments so that Iran had no other way but to reduce its commitments under the deal,” a letter from Iranian President Hassan Rouhani to the European Union is expected to read, according to state-run IRNA.

Speaking to the press prior to arriving in Baghdad, Pompeo said the US would look at Iran’s action regarding the JCPOA, but said that compliance with the deal was “binary.”

“You’re either in compliance or you’re not. And so we’ll obviously have to wait and see what they choose to do, but in – you’re – it’s zeroes and ones. You’re either in compliance with the agreement or you’re not. And so, look, we’ve withdrawn from the agreement. The Iranians will have to make their own choice about how they want to proceed,” he said.

CNN’s Nicole Gaouette, Barbara Starr and Tara John contributed to this report.