Pentagon chief Ashton Carter held talks in Baghdad Thursday on Iraq's war against the Islamic State group, whose "caliphate" is shrinking but is ramping up deadly car bombings.

His visit came as Iraqi troops, some of which were trained by the United States, tightened the noose on IS in Ramadi, the capital of Anbar province which the government lost in May.

On his first visit since taking office as defence secretary earlier this year, Carter met Prime Minister Haider al-Abadi and some of the 3,500 US troops deployed in the country.

He also met a number of top Sunni politicians, including the parliament speaker, Salim al-Juburi, and officials from Anbar and Nineveh, the two regions where IS has the largest footprint.

Any attempt to take back Mosul, the capital of Nineveh and the largest city in the "caliphate" IS proclaimed over parts of Iraq and Syria last year, has been put on the backburner.

The Iraqi government has instead focused on Anbar, vast western province which stretches from the borders with Syria, Saudi Arabia and Jordan all the way to the outskirts of Baghdad.

Coalition aircraft, which have carried out thousands of strikes in Iraq and Syria during the past year, have lately been hitting dozens of targets in Anbar every week.

"Iraqi security forces are in the process of encircling" Ramadi, said Pentagon spokesman Colonel Steve Warren, who is travelling with Carter.

– Newly-trained troops join battle –

He put the number of jihadist fighters defending the city at 1,000 to 2,000.

He would not say when he thought a drive to wrest the city back from IS might be launched in earnest but said it should be a matter of "weeks".

US military advisers have trained 9,000 Iraqi soldiers since their deployment but they had never seen frontline action until a first batch of 3,000 recently joined the Ramadi battle, Warren said.

"This is a development we are very satisfied to hear," he told reporters in Baghdad.

Several hundred US troops are also helping Iraqi forces train local Sunni Arab tribesmen at a large base in Habbaniyah, between Ramadi and the jihadists' other Anbar bastion of Fallujah.

Warren said 1,800 tribal fighters had already received training and equipment under the programme.

But Anbar tribal leaders want more from Washington.

"The coalition's support to Anbar and its sheikhs is weak on all levels, mainly the humanitarian level… and the security level when it come to support for the tribes in liberating their areas," Rafia al-Fahdawi, a tribal leader whose forces have been fighting alongside the government.

Baghdad's other main partner in the fight against the Islamic State is Tehran, which also has advisers on the ground and directly supports the powerful Shiite militias now playing a lead role in the military effort.

Iran is not part of the coalition, and while this month's historic nuclear deal opened a new chapter in relations between Tehran and Washington, their coexistence on Iraq's battlefield remains uneasy.

The Iraqi army, backed by Washington, wants to take back Ramadi first, but the Hashed al-Shaabi — an umbrella organisation for Tehran-backed groups that Abadi only nominally controls — has made Fallujah its priority.

– IS claims Baghdad car bombs –

After initially expanding in the wake of its proclamation of a "caliphate" over parts of Iraq and Syria last summer, the group led by Abu Bakr al-Baghdadi has seen the internationally supported Iraqi fightback roll back its borders.

The jihadists are also under pressure in Syria, where they have lost several key areas along the border with Turkey.

Observers have warned that as military pressure on IS mounts in the battlefield, the group risks reverting to its old tactics of hit-and-run attacks and car bombs.

It claimed one of the biggest suicide car bomb attacks in Iraq's bloody history last week when around 120 people were killed by a blast that ripped through a market in the town of Khan Bani Saad, just north of Baghdad.

The town is located in Diyala province, which has a border with Iran. The government announced it had "liberated" it in January but it has since struggled to restore stability there.

The jihadists have also carried out a spate of car bomb attacks in the capital, the latest of which came on Wednesday evening.

IS issued a statement on jihadist forums on Thursday claiming responsibility for the two bombs in predominantly Shiite neighbourhoods that killed at least 21 people.

Another pair of car bombs killed at least 23 people in Baghdad on Tuesday.