IRAQ HAS been shattered by a jihadist blitzkrieg, and some in the United States are ready to write off what’s left of the country in whose liberation and democratization Americans have invested so heavily. To those who would abandon Iraq, President Obama had a welcome response Thursday: not so fast. As Mr. Obama explained, the United States has “a stake in making sure that these jihadists are not getting a permanent foothold in either Iraq or Syria, for that matter.” He and his national security team are considering emergency military aid in addition to the assistance they have quietly supplied in recent months. Crucially, Mr. Obama declined to rule out approving the U.S. airstrikes that Baghdad has been requesting since the forces of the Islamic State of Iraq and Syria began spreading into Iraq from Syria months ago but which Washington has so far refused.

A decision to shore up Prime Minister Nouri al-Maliki’s government would, at this point, be an on-balance judgment. Mr. Maliki has too often governed as a kind of elected sectarian dictator on behalf of his Shiite compatriots and Iranian patrons rather than the inclusive leader his other patrons, in Washington, have repeatedly urged him to be. ISIS’s rapid occupation of a string of Sunni cities north of Baghdad says less about the insurgents’ fighting skills than the disdain with which Iraq’s troops regard Mr. Maliki. Most of them fled rather than pick up their U.S.-supplied weapons on his behalf. Mr. Obama was justified in describing the ISIS offensive as “a wake-up call for the Iraqi government” — a last chance to mend its ways and to pursue the kind of Sunni-Shiite cooperation that U.S. commanders effectively brokered when they were still in the country.

Still, a frank acknowledgment of the Baghdad government’s flaws must be tempered by an equally clear assessment of the enemy it now faces. If an ISIS-dominated “caliphate” were to take root in the swath of Syrian and Iraqi territory the group now controls, it would be a base of operations for terrorist strikes around the world, including the United States. It also would be a harsh dictatorship in which “apostates” — defined as anyone who does not accept ISIS’s brand of puritanical Islam — face summary execution. Eager as it was to resume its advance, ISIS still found time to burn the Assyrian church in Mosul. Nor is it in the interest of the United States, or the region, to leave Mr. Maliki totally reliant on Iran, whose covert forces reportedly are already on the ground, ready to assist him against ISIS and, presumably, gain even greater regional power for Tehran.

The temptation to let Iraq fend for itself is strong and, given the history, understandable. Some may even see a chance for stability in reconfiguring the country along its sectarian Sunni, Shiite and Kurdish lines. But there are no neat dividing lines. A breakup of Iraq is likely to bring endless violence to its people and many others around the world. Not to do everything possible to avert that outcome would be a dereliction, and one that Americans might greatly regret for years to come.