CAIRO — The Arab states said on Sunday that they had agreed to form a combined military force to counter both Iranian influence and Islamist extremism, a gesture many analysts attributed in large part to their drive for more independence from Washington.

The agreement came as American and other Western diplomats in Lausanne, Switzerland, were racing to beat a self-imposed deadline of Tuesday to reach a deal with Iran that would restrict its nuclear program in exchange for the removal of economic sanctions. In response, Saudi Arabia and other American allies in the region have made clear that they are seeking to bolster independent regional security measures because they see the proposed accord as a betrayal of Washington’s commitment to their security.

Regardless of Iran’s nuclear program, they complain, the deal would do nothing to stop Iran from seeking to extend its influence around the region by backing favored factions, as it has done in Lebanon, Iraq, Bahrain and Yemen.