The United Nations and the International Committee for the Red Cross withdrew their staff members from the besieged Yemeni port city of Al Hudaydah, fearing that an attack by forces led by the United Arab Emirates was imminent, officials said Monday.

Frantic diplomacy to stave off an attack on the city of 600,000 people and avert a potential humanitarian disaster moved to the United Nations on Monday, where the Security Council held a closed-door briefing on the situation.

“We are, at the present moment, in intense consultation,” the United Nations Secretary General António Guterres said Monday. “There is a lull in the fighting to allow for them, and I hope that it will be possible to avoid a battle for Hudaydah.”

In Washington, bipartisan efforts were underway in the Senate to warn the Emirates and its ally in Yemen, Saudi Arabia, that a military assault on Al Hudaydah could result in the United States cutting off funding for aerial refueling, which has been crucial to the Saudi air campaign there.

Although the Trump administration has developed close ties with Saudi Arabia and the United Arab Emirates, many members of Congress and international diplomats blame the two countries for exacerbating what the United Nations says is the world’s worst humanitarian crisis with indiscriminate attacks that have been responsible for thousands of civilian deaths.

An attack on Al Hudaydah would “plunge the country further into humanitarian disaster and risk opening another power vacuum for Al Qaeda to fill,” said Representative Ted Lieu, a Democrat of California and a former Air Force lawyer. “If they cross that red line, the U.S. will have a strategic, moral and legal obligation to cut off all support for the coalition in Yemen.”

Diplomats in the region said that only pressure from Washington, which sells tens of millions of dollars of weapons to the United Arab Emirates and to Saudi Arabia every year, could stop the assault.

The two Arab countries’ close relationships with the White House — and the deep divisions in Washington — have emboldened them to push ahead with their own agendas, including the war in Yemen.

In a statement on Monday, Secretary of State Mike Pompeo said he had spoken to Emirati leaders “and made clear our desire to address their security concerns while preserving the free flow of humanitarian aid and lifesaving commercial imports.”

He said the United States expected “all parties” to work with the United Nations special envoy for Yemen and to “support a political process to resolve this conflict.”

Saudi Arabia and the United Arab Emirates have led a coalition fighting Iranian-backed Houthi rebels, who ousted the Yemeni government three years ago.

Al Hudaydah, which has been controlled by the Houthis for two years, is the gateway for approximately 80 percent of the foreign humanitarian aid entering Yemen. The United Nations has warned that an attack on the city could cause more than a quarter of a million civilian deaths.

American officials have warned the Emirati and Saudi governments that an offensive there would result in a quagmire.

Part of the Emirati calculation appears to be the desire to strike a huge blow against the Houthis, which the U.A.E. and Saudi Arabia consider a proxy for their regional nemesis, Iran. That coalition has long sought to seize the city and deny the Houthis a vital piece of territory, while giving the Arab nations an upper hand in peace negotiations.

The United Nations special envoy to Yemen, Martin Griffiths, has been working to forge an agreement with the Houthis to hand over control of the city and its port to the international body, depriving the Emiratis and Saudis of their rationale for an attack.

Diplomats familiar with the situation say that while he has made progress, it is unclear whether the Saudis and the Emiratis would back any such breakthrough. There was no immediate response from the Emirati government on Monday about the plan to attack Al Hudaydah.

Diplomats involved in behind-the-scenes negotiations say that the United Arab Emirates officially warned the British government on Friday that an attack on Al Hudaydah was imminent. The Emiratis said then that they would give three days for humanitarian workers and nongovernmental organizations to flee the city.

Yemen’s civil war began with a breakdown of political talks in the wake of Arab Spring protests that toppled former President Ali Abdullah Saleh. Longstanding political divisions over power sharing gave way to military conflict, giving rise to a variety of short-term alliances across the impoverished and deeply divided nation.

The current configuration of forces pits the predominantly Shiite Houthi rebels, who before the war started were long marginalized by Saudi-backed proxy groups in Yemen, against Sunni tribal and other militia groups that are backed by the Emiratis and Saudis.

The United States has backed the Arab states in the war, but the U.A.E. has received powerful pushback from various American officials who see the idea of an urban assault on a densely populated city as an unmitigated disaster, in both military and humanitarian terms.

Defense Secretary Jim Mattis has also privately sent messages to the Arab states, cautioning against any attack on Al Hudaydah, according to two people familiar with the situation. American military officials do not want Congress to prevent military aid to the two nations, both of which are crucial allies in counterterrorism, nor do they want a vacuum of power in Yemen to result in a new incubator for extremist groups like the Islamic State and Al Qaeda.

The Senate measure would cut off funds for the American refueling of Saudi fighter jets in the conflict unless the State Department certifies that Saudi Arabia is increasing Yemenis’ access to food, fuel, medicine and medical evacuation, including through the port of Al Hudaydah.

International aid groups prepared for the worst-case situation by moving staff members to safety while working on contingency plans to keep vital humanitarian supply lines open.

The United Nations worked out terms with the Houthi rebels on Sunday an moved out its foreign staff from Al Hudaydah in multiple convoys on Monday. United Nations agencies planned to leave in place a skeleton crew of Yemenis from that city to continue some of the aid mission.

A reflection of how dire the situation on the ground inside Al Hudaydah was that the International Committee for the Red Cross removed its staff from the city over the weekend. The British government also issued guidance to aid agencies receiving British funding to leave the city.

A version of this article appears in print on , on Page A7 of the New York edition with the headline: U.N. Pulls Out of City in Yemen, Fearing Assault by an Arab Coalition. Order Reprints | Today’s Paper | Subscribe