“We are happy to continue the conversation with the Iraqis about what the right structure is,” Mr. Pompeo said at a news conference after the State Department had made its announcement. He stressed that the mission of the United States in Iraq was to train Iraqi forces to fight the Islamic State, and “we’re going to continue that mission.”

“But as times change and we get to a place where we can deliver up on what I believe and the president believes is our right structure, with fewer resources dedicated to that mission, we will do so,” he added.

Pressed on the issue, Mr. Trump on Friday sounded less like his secretary of state and more like he did during the presidential campaign in 2016, when he pledged to withdraw American troops from overseas conflicts.

In an interview on Fox News, the president was asked whether this was an opportunity to bring American troops home from Iraq. “I’m O.K. with it,” Mr. Trump said. But the president also said that while Iraqi officials may call for an American withdrawal in public, “They don’t say that privately.”

Iraqi lawmakers voted on Sunday to expel United States forces after the American drone strike that killed 10 people in a two-car convoy — Maj. Gen. Qassim Suleimani, a top Iranian commander, four of his Iranian aides and five Iraqis, including a senior militia leader, Abu Mahdi al-Muhandis. The prime minister has not signed the bill yet, but had been criticizing the American troop presence in Iraq since a series of recent actions by the United States military.