UNITED NATIONS, AUG. 18 -- The United Nations Security Council tonight demanded unanimously that Iraq's government release the thousands of foreign citizens it is detaining in Iraq and Kuwait.

The resolution was adopted by the 15-nation council hours after U.N. Secretary General Javier Perez de Cuellar said he is sending two high-ranking U.N. officials to Baghdad to open talks on the fate of the foreigners. The U.N. moves were prompted by the announcement Friday by Iraq's National Assembly speaker that detained citizens of "aggressive nations" would be moved to military and industrial sites likely to be targets should warfare break out with U.S.-led forces.

The U.S.-proposed resolution "demands that Iraq permit and facilitate the departure from Kuwait and Iraq of the nationals of third countries and grant immediate and continuing access of consular officials" to those foreigners.

The resolution came hours after Baghdad warned that the captives would suffer from all food and other shortages arising from sanctions against Iraq. The Security Council called on Iraq to "take no action to jeopardize the safety, security or health" of the detainees.

It also demanded that Iraq "rescind its orders for the closure" of foreign embassies in Kuwait City.

U.S. Ambassador Thomas R. Pickering told the council after the vote that "Iraq crossed the Rubicon" in the preceding 24 hours by making clear it was "planning to use innocent third-country nationals as human shields around military installations."

The unanimous resolution came despite accounts by diplomatic sources saying that some Security Council members had favored delaying a vote until after Perez de Cuellar had had a chance first to defuse what is potentially the biggest hostage-taking in modern history.

Perez de Cuellar announced his initiative in Lima, Peru, in response to a request from the Security Council Friday that he take all "appropriate" steps to win release of the foreigners, who were detained after Iraq's invasion of Kuwait Aug. 2. His chief of staff, Virendra Dayal, and U.N. Controller Kofi Annen are to arrive in Baghdad Monday. Perez de Cuellar said they would "make contact with the appropriate authorities and study the best way to find a solution to the foreigners' situation," Reuter reported from Lima.

U.N. Secretariat officials said Perez de Cuellar hopes the mission will ease tensions over the detainees and open the way to negotiations over their future. However, the officials cautioned, rising confrontation between the United Nations and Iraq does not seem to bode well for the quiet diplomacy for which Perez de Cuellar is noted.

Perez de Cuellar is not scheduled to return from his native Peru before next weekend, and the officials said they did not know tonight whether he will come back earlier.

If his emissaries fail to establish some kind of negotiating beachhead, the United Nations almost certainly will be forced to consider whether the plight of the hostages requires it to change the measured, step-by-step approach it has taken toward Iraq and move to tougher steps of a possibly military nature.

If a connection is made, many diplomats are hopeful that Perez de Cuellar will be able to exploit the experience and goodwill he gained with the Iraqis two years ago when he mediated the truce in their war with Iran.

More pessimistic sources noted, though, that Perez de Cuellar has been most comfortable dealing with Iraqi diplomats such as the urbane foreign minister, Tariq Aziz. However, Aziz, who a few days ago seemed to be assuring Westerners that the detainees had nothing to fear, now appears to have been pushed aside by more strident military and nationalist forces urging Saddam toward continued confrontation.

The U.N., dealing with its first major crisis of the post-Cold War era, has shown remarkable unanimity in demanding that Iraq's aggression be rolled back. The Security Council, without a dissenting vote, has adopted resolutions calling for Iraqi withdrawal from Kuwait, imposing far-reaching economic sanctions against Iraq and declaring its annexation of its tiny neighbor "null and void."

Until now, however, it has balked at taking military action. Many members have criticized the U.S. interdiction of Iraqi shipping, and there has been a clear consensus here that diplomacy and economic pressure should be given a full trial before more drastic action is contemplated.

At the suggestion of the Soviet Union, the five permanent members of the Security Council are discussing whether a U.N. military committee can take a role in putting the U.N. flag over a multinational naval blockade to enforce the sanctions.

But, while three meetings were held about this here and in Washington this past week, sources familiar with them said progress has been slow. China reportedly has been particularly skittish about the idea of the United Nations taking any military action, and the other permanent members are unsure how far member states would go in surrendering control over their forces to the world body.

Since Aug. 6, when the sanctions resolution was passed, most members have assumed that the United Nations would have a grace period of roughly a month before having to weigh whether tougher measures were needed. Now, the question is whether Iraq's use of the foreign citizens to raise the ante may have shrunk that period to only a few days.