The visit comes after President Donald Trump said this month that a US presence was needed to observe Iran.

In his first trip to Iraq, Shanahan is set to meet with Iraqi officials, including Prime Minister Adel Abdul Mahdi.

“We are in Iraq at the invitation of the government and our interests are to build Iraqi security capability,” Shanahan told reporters traveling with him.

“I want to hear first-hand from them about concerns, the political dynamics that they are facing and then based on that we will obviously factor that into our planning.”

Shanahan will also discuss the withdrawal of US troops from Syria with US commanders.

Trump caused anger in Baghdad this month when he said it was important to keep a US military presence in Iraq so that Washington could keep a close eye on Iran “because Iran is a real problem.”

Trump’s comments prompted almost universal criticism from Iraq’s leaders, including from the president and prime minister, and raised questions about the long-term presence of US troops in the country 16 years after the US-led invasion that toppled Saddam Hussein.