President Donald Trump upset Iraqis by saying earlier this month that US forces should use their Iraqi positions to keep an eye on neighbouring Iran.

Harir Air Base in Erbil province of Iraq, which is expected to be used by US troops in withdrawal from Syria.
Harir Air Base in Erbil province of Iraq, which is expected to be used by US troops in withdrawal from Syria. (AA)

The top Pentagon official arrived in Baghdad on Tuesday to consult with American military commanders and Iraqi government leaders on the future US troop presence in Iraq.

Pat Shanahan, the acting secretary defence, said before his unannounced trip that he wanted to hear first-hand about the state of Iraq's fight against remnants of the Daesh group. 

"We are in Iraq at the invitation of the government and our interests are to build Iraqi security capability," Shanahan told reporters travelling with him on his first trip to Iraq.

President Donald Trump said this month that a US presence was needed in Iraq to observe Iran, which would overstep the US-led coalition's stated mission in Iraq and Syria of defeating Daesh.

"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 declined to say whether he would propose that additional US special operations troops be brought to Iraq to, in effect, compensate for a pullout from Syria to begin within weeks.

The US has about 5,200 troops in Iraq to train and advise its security forces, 16 years after the US invaded to topple Saddam Hussein.

Shanahan is also to meet with Prime Minister Adel Abdul Mahdi.

Foreign influence

Iraqis were not happy with Trump's statement about using Iraqi positions to monitor Iran. That is not the stated US mission in Iraq, and Iraqi officials have said Trump's proposal would violate the Iraqi constitution.

Trump also has angered Iraqi politicians by arguing that he would keep US troops in Iraq and use the country as a base from which to strike extremists in Syria if necessary, after the 2,000 troops now in Syria depart in coming weeks.

Curbing foreign influence has become a hot-button issue in Iraq after parliamentary elections last year in which Shia politicians backed by Iran made significant gains. Meanwhile, Shia militias that fought alongside US-backed Iraqi government troops against Daesh in recent years gained outsized influence along the way.

This political tension formed the backdrop to Shanahan's visit, which marks his first time in Iraq.

He took over as the acting Pentagon chief after Jim Mattis resigned as defence secretary in December. It's unclear whether Trump will nominate Shanahan for Senate confirmation.

On Monday, Shanahan was in Afghanistan, where he met with US troops and President Ashraf Ghani amid a US push for peace talks with the Taliban. Trump has indicated he would like to get US troops out of Afghanistan after 18 years of war, but Shanahan said he has no orders for a troop drawdown.

Although Afghanistan is America's longest war, fighting in Iraq has taken a heavier toll on American lives.

Daesh caliphate 
Former president Barack Obama pulled troops out of Iraq in December 2011 but sent them back in smaller numbers in 2014 after Daesh swept across the border from Syria and took control of much of western and northern Iraq.

Since the height of its self-proclaimed caliphate that included a third of both Iraq and Syria, Daesh-held territory has now shrunk to a sliver of territory in eastern Syria where remaining militants are fighting back.

Trump has not publicly called for a US withdrawal from Iraq, although he often calls the 2003 invasion a colossal mistake and has said the US should have taken Iraq's oil as compensation for getting rid of Saddam.

Source: AP