BAGHDAD — America’s top military leader arrived in Iraq on Saturday on an 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.

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.

Dempsey said Thursday that Iraqi forces were doing a better job now, although an effort 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.