BAGHDAD -- America's top military leader arrived in Iraq on Saturday on a previously unannounced visit, his first since a U.S.-led coalition began launching airstrikes against the extremist Islamic State group.

The visit by Army Gen. Martin Dempsey, chairman of the U.S. Joint Chiefs of Staff, came just two days after he told Congress that the United States would consider dispatching a modest number of American forces to fight with Iraqi troops against the extremist group.

The Iraqi military and security forces, trained by the U.S. at the cost of billions of dollars, melted away in the face of the group's stunning offensive this summer, when it captured most of northern and western Iraq, including the country's second-largest city Mosul.

Dempsey said Thursday that Iraqi forces were doing a better job now, although an effort to move into Mosul or to restore the border with Syria would require more complex operations.

He also told the U.S. House Armed Services Committee that America has a modest force in Iraq now, and that "any expansion of that, I think, would be equally modest."

"I just don't foresee a circumstance when it would be in our interest to take this fight on ourselves with a large military contingent," he said.

Dempsey's spokesman, Air Force Col. Ed Thomas, said the general planned to visit U.S. troops, commanders and Iraqi leaders. "The primary purpose of his visit is to get a firsthand look at the situation in Iraq, receive briefings, and get better sense of how the campaign is progressing."

The visit included talks in Baghdad with Prime Minister Haider al-Abadi and U.S. Ambassador Stuart E. Jones, Thomas said.

Dempsey later flew to Irbil, capital of Iraq's largely autonomous northern Kurdish region, where he met with Kurdish Prime Minister Nechirvan Barzani.

Dempsey also visited the U.S. joint operations centre in Irbil, got a briefing on the Kurdish offensive against the Islamic State group and held a town hall with deployed troops there, Thomas said.

The Pentagon has plans to establish an expeditionary advise and assist centre in Irbil where U.S. troops will provide assistance to Iraqi forces at the brigade and higher levels. The U.S. also is planning to set up a training site near Irbil.

According to plans laid out last week, the U.S. expects to train nine Iraqi security forces brigades and three Kurdish Peshmerga brigades.

Dempsey's visit to Iraq comes a day after Iraqi forces drove Islamic State militants out of a strategic oil refinery town north of Baghdad, scoring their biggest battlefield victory yet.

On Saturday, state television said government forces were in full control of the refinery, Iraq's largest, which lies some 20 kilometres (15 miles) north of the town of Beiji.

The loss of Beiji marks the latest in a series of setbacks for the jihadi group, which has lost hundreds of fighters to U.S.-led coalition airstrikes in Iraq and Syria, particularly in the group's stalled advance on the Syrian town of Kobani. On Friday, activists there reported significant progress by the town's Kurdish defenders.

Meanwhile on Saturday, two parked car bombs exploded minutes apart north of Baghdad, targeting a security checkpoint, authorities said. The attack killed nine people and wounded 32, according to police and hospital officials.

Later, a booby-trapped house in northern Baghdad blew up as a joint army and police force searched it for weapons, killing five and wounding 10, according to hospital and police officials.

The officials spoke on condition of anonymity because they were not authorized to brief journalists.