Midway through his second term, President George W. Bush found himself facing a foreign-policy disaster largely of his own making. He had ordered an invasion of Iraq without a sufficiently large force to occupy the country and without a well-considered plan for its reconstruction. Under his direction, the Iraqi military and government were dismantled with nothing to take their place, and by 2006 the nation was on the verge of a full-blown sectarian war.

Without explicitly acknowledging his miscalculations, Bush changed course. He replaced his defense secretary and his field commanders. He ignored the advice of a bipartisan commission to essentially accept defeat, deciding that U.S. national security would be harmed by Iraq’s fracturing. He ordered a surge of troops and a new strategy that helped restore stability.

At the same midpoint of his second term, President Obama faces a similar challenge, and at a news conference last week he offered some indications of a similar willingness to rethink.

The immediate challenge this poses for the United States is confounding. Iraq Prime Minister Nouri al-Maliki has put sectarian interests above national goals, so to join him in beating back the terrorist challenge might only widen the country’s divide. But even if Al-Maliki continues to ignore American advice to be more inclusive, an Al-Qaida-style “caliphate” stretching from Syria into Iraq would be too dangerous for the United States and its allies. Obama is trying to square that circle, and the measures he outlined last week represent a judicious start.

First, and in some ways most important, Obama committed the United States to meeting the challenge. Second, he ordered military and diplomatic moves to back up his words: increased intelligence operations, more aid to Iraq’s military, joint operations centers in Baghdad and northern Iraq, and the deployment of as many as 300 military advisers. These are appropriately modest steps as the United States assesses the situation and pushes for political responses in Iraq and the region. The latter will be essential, which is why Obama’s dispatch of Secretary of State John Kerry to the region this weekend is critical. At the same time, Obama made clear that the United States would act more forcefully if warranted as he beefs up the U.S. military presence.