BAGHDAD — In a surprise speech late Sunday, Iraqi Prime Minister Nouri al-Maliki resisted calls for his resignation and accused the country’s new president of violating the country’s constitution, a speech that plunged the government into a political crisis while it battles advances by Islamic State militants.

Al-Maliki’s condemnation of President Fouad Massoum was a defiant move at a time of U.S. airstrikes against the Islamic insurgents in Iraq’s north. President Obama has maintained that only a new, inclusive government can begin to solve Iraq’s turmoil.

Obama warned Americans on Saturday that the new campaign to bring security in Iraq would require military and political changes and “is going to be a long-term project.”

Obama said Iraq needs a prime minister — an indication that he has written off the legitimacy of al-Maliki, who is seeking a third term.

Critics of the Shiite leader say he contributed to the crisis by monopolizing power and pursuing a sectarian agenda that alienated the country’s Sunni and

Kurdish minorities.

Just hours after al-Maliki's speech, the U.S. State Department said Sunday it “fully supports” the new Iraqi president.

State Department spokeswoman Jen Psaki said in a statement the U.S. supports the process to select a prime minister “by building a national consensus and governing in an inclusive manner.” She said the U.S. rejects any effort to use coercion or manipulation in the process of choosing a new Iraqi leader.

The latest crisis has prompted even al-Maliki’s closest allies to call for his resignation. A parliament session scheduled for Monday to discuss the election and who might lead the next Iraqi government was postponed until Aug. 19.

In a nationally televised speech Sunday night, al-Maliki declared he will file a legal complaint against Massoum for committing “a clear constitutional violation.”

Al-Maliki, whose Shiite-dominated bloc won the most seats in April elections, accused Massoum of neglecting to name a prime minister from the country’s largest parliamentary faction by Sunday’s deadline. He said the president violated the constitution “for the sake of political goals.”

Al-Maliki, speaking on Iraqi TV for the first time since U.S. forces launched airstrikes and humanitarian airdrops in Iraq last week, said the security situation would only worsen as a result of Massoum’s actions.

“This attitude represents a coup on the constitution and the political process in a country that is governed by a democratic and federal system,” al-Maliki said. “The deliberate violation of the constitution by the president will have grave consequences on the unity, the sovereignty, and the independence of Iraq and the entry of the political process into a dark tunnel.”

The political infighting could hamper efforts to stem advances by the Islamic State militants who seized a large swath of northern and western Iraq in recent weeks.

Kurdish forces defending their semi-autonomous region from the militants have been reinvigorated by U.S. airstrikes. Kurdish forces retook two towns Sunday, one of their first victories after weeks of retreating, a senior Kurdish military official said.

Kurdish peshmerga fighters were able to push the militants out of the villages of Makhmour and al-Gweir, some 28 miles from the Kurdish capital of Irbil, Brig. Gen. Shirko Fatih said.

The United States launched a fourth round of airstrikes Sunday against vehicles and mortars firing on Irbil as part of its declared effort to protect American personnel in and around the Kurdish capital.

U.S. warplanes and drones have also attacked militants firing on minority Yazidis around Sinjar, which is in the far west of Iraq, near the Syrian border.

In the Kurdish capital on Sunday, the president of the Kurdish Regional Government, Massoud Barzani, said American military support has been effective thus far, but he added that peshmerga soldiers would require more firepower.

“We are not asking our friends to send their sons to fight on our behalf,” Barzani told The Associated Press in a brief interview. “What we are asking our friends is to provide us support and to cooperate with us in providing us with heavy weapons that we are able to fight this terrorist group.”

Barzani met Sunday with French Foreign Minister Laurent Fabius, who traveled to Baghdad and Irbil pledging France’s commitment to provide humanitarian aid. Fabius also met with al-Maliki and called on Iraqi leaders to unite in the face of the escalating crisis.

“The marching order is solidarity,” Fabius said. He called on Iraqis to form a “government of broad unity so that all Iraqis feel represented and together lead the battle against terrorism.”

A week ago, al-Maliki ordered the Iraqi air force to support Kurdish forces against the militants, a rare instance of cooperation between Baghdad and the Kurdish regional government, which have been locked in disputes over oil and territory for years.

Meanwhile, thousands of Yazidi refugees fleeing the militants continued to pour across the border from Syria into Iraq after a weeklong journey through blazing hot mountains. Followers of an ancient religion with links to Zoroastrianism, the Yazidis said the militants had given them the choice of converting to Islam or dying.

As they crossed the border, many Yazidis said they had lost sisters, daughters, young children and elderly parents during the trip. They said militants sprayed gunfire at fleeing crowds, sometimes splitting up families by taking the women and killing the men.

It was not clear how many Yazidis were missing. In the span of 30 minutes, about a dozen displaced Yazidis approached one journalist, pleading for assistance in finding their loved ones.