BAGHDAD — Iraqi security officials said Wednesday that fighters with the Islamic State in Iraq and Syria were advancing on the Haditha Dam, the second-largest in Iraq, raising the possibility of catastrophic damage and flooding.

Worries about the dam came as Prime Minister Nuri Kamal al-Maliki criticized his political rivals but did not reject entreaties by Western leaders, including a personal visit by Secretary of State John Kerry, to help defuse the crisis by forming a new government with more equitable power sharing among competing groups.

The ISIS militants advancing on the Euphrates River dam, about 120 miles northwest of Baghdad, were coming from the north, the northeast and the northwest. The fighters had already reached Burwana, on the eastern side of Haditha, and government forces were fighting to halt their advance, security officials said.

Alarmed army officers told employees to stay inside and to be prepared to open the dam’s floodgates if ordered to do so, one employee said.