Acting U.S. defense chief Patrick Shanahan told Iraqi leaders that Washington understood its forces were in Iraq at Baghdad's invitation, aiming to steady relations after President Donald Trump said U.S. troops were needed to keep an eye on Iran.

Shanahan met Prime Minister Adel Abdul Mahdi during an unannounced trip to Baghdad on Tuesday.

"I made very clear that we recognize their sovereignty, their focus on independence and that we are there at the invitation of the government," Shanahan told reporters.