The top American diplomat's unannounced trip to the Iraqi capital began and ended after nightfall under heavy security following the abrupt cancellation of a visit to Germany.
Journalists from The Associated Press and other organizations accompanying Pompeo were not told of his new destination until his plane left for Baghdad and were not allowed to report on his whereabouts until after his plane had taken off for London.
The secretary told reporters on the flight that his meetings with Iraq's president and prime minister were intended to demonstrate U.S. support for "a sovereign, independent" Iraq, free from the influence of neighboring Iran.
Pompeo also said he wanted to underscore Iraq's need to protect Americans in their country.
"We 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," he said. "They understood, too, it's important for their country."
Pompeo's visit came as the Trump administration intensified its pressure campaign against Iran. The U.S. said this week that it was rushing an aircraft carrier group to the Middle East to deter or respond to any Iranian attack.
U.S. officials have said there were indications Iran was planning to retaliate for the Trump administration's stepped-up sanctions on the country, although the threat information remains vague.
Pompeo would not be specific about the more recent threat information involving Iran except that they involved "imminent" plans for attacks. "We're taking every action to deter them," he said. "Other than that, I just can't say any more."
Before landing in Baghdad he said that that he would make clear in his meetings that any attack by Iran or its proxies on American forces in Iraq would affect the Iraqi government too.
The "campaign to continue to prevent ISIS terror inside of Iraq itself is something that's very central ... to the Iraqi government," Pompeo said.
In Washington, an American official said the decision to deploy the carrier group and a group of Air Force bombers to the Middle East was based in part on intelligence indications that Iran had moved short-range ballistic missiles by boat in waters off its shores.
Iran, meanwhile, was expected to announced Wednesday that it would partially withdraw from the nuclear deal it struck with world powers in 2015.
But Iraq is also tightly enmeshed with Iran in trade, security and political matters, and it has been loath to antagonize its larger neighbor. Iran won the ear of many top Iraqi politicians after it stepped in to fill the political vacuum following the 2003 U.S. invasion. It also can count on the loyalty of several powerful Iraqi militias, which have fought previously against U.S. forces in the country and on the side of Iran's allies in Syria in that country's civil war.
Responding to a question about whether Iraq could protect U.S. interests from attacks by Iran and its proxy forces, Prime Minister Adel Abdul-Mahdi said Tuesday that Iraq takes its responsibilities seriously. "This is an obligation that Iraq honors," he said.
Trump withdrew from the Obama administration's landmark nuclear deal with Iran in May 2018 and, in the months that followed, reinstated punishing sanctions, including those targeting Iran's oil, shipping and banking sectors.
While Trump has sought to dismantle much of President Barack Obama's policies, he particularly criticized the Iran nuclear deal for failing to address Tehran's ballistic missile program and what he described as its malign influence across the rest of the Mideast.
Associated Press writer Philip Issa in Baghdad contributed to this report.