By Lin Noueihed and Omar Fahmy

CAIRO (Reuters) - Arab League foreign ministers agreed on Sunday to take all necessary measures to confront Islamic State and cooperate with international, regional and national efforts to combat militants who have overrun swathes of Iraq and Syria.

The Arab League also endorsed in the closing statement of its meeting in Cairo a UN Security Council resolution passed last month calling on member states to "act to suppress the flow of foreign fighters, financing and other support to Islamist extremist groups in Iraq and Syria".

Baghdad had earlier submitted a draft resolution endorsing its own efforts to confront militants who have seized large areas for a cross-border caliphate and to condemn Islamic State's actions as war crimes and crimes against humanity.

Diplomatic sources said before the meeting that Arab foreign ministers were set to endorse a U.S. aerial campaign against the group and Egypt's official Mena news agency said the ministers would agree to coordinate with the United States.

The final text did not directly endorse either the Iraqi or U.S. campaign against Islamic State, but diplomatic sources said the wording clearly offered Arab cooperation to U.S. and Iraqi efforts and could be read as a tacit agreement to back Washington's campaign against the group.

At the opening session, several foreign ministers spoke of the gravity of the challenge posed by Islamic State in Iraq as well as the violence that has engulfed Libya and other regions.

Arab League chief Nabil al-Arabi told the session that the rise of the group in Iraq challenged not merely the authority of the state but "its very existence and the existence of other states" and called for a decisive resolution to confront terrorism militarily, politically, economically and culturally.

Arabi suggested that military action could take place under the umbrella of an Arab League joint defense pact.

It was not clear whether the Arab commitment to take all necessary action against Islamic State and other militant groups would include direct military involvement in Iraq or Syria.

Story continues

President Barack Obama declared last week that the United States was ready to "take out" leaders of Islamic State, and said NATO allies were prepared to join military action against a movement that he labeled a major threat to the West.

U.S. warplanes carried out four strikes against Islamic State militants threatening western Iraq's Haditha Dam early on Sunday, witnesses and senior officials said, broadening Washington's campaign against the fighters.

Obama would like Gulf Arab states to consider military action, but also to support Sunni Muslim moderates in Iraq and Syria who could undermine the appeal of Islamic State. He also wants Islamic State's sources of funding cut off, a point on which the closing statement touched.

U.S. Secretary of State John Kerry is to travel to Saudi Arabia and Jordan in the coming week for talks with Gulf leaders to determine whether they are prepared to back up their anti-jihadist rhetoric with action.

In a change of position, the Arab League statement also called for Syrian opposition groups to hold talks with the state aimed at creating a reconciliation government.

As the Syrian conflict has dragged on and Islamic militants have taken the upper hand, early Arab League support for opponents of Bashar al-Assad has given way to a more cautious tone.

(Editing by Rosalind Russell)