Libya, a storehouse of Soviet arms, declared support for Iran in its war with Iraq yesterday and said Arab countries have an "Islamic duty" to back Tehran in the escalating 19-day-old conflict.

The endorsement came as Iran and Iraq issued warnings to residents of enemy cities implying that wider and more devastating attacks were being planned on populated areas and as Iran announced in New York that it wants to take its case to the U.N. Security Council, whose deliberations it previously had shunned.

The Libyan move made it the first Arab nation to back openly the Persians of Iran against the Arabs of Iraq, further fracturing Arab unity and underscoring dangers that the Iranian-Iraqi hostilities could involve other countries in the region. Syria, which recently agreed to a proposal for unity with Libya, has attacked its ideological enemies in Baghdad but refrained from open and total support for Iran such as that declared by Libya's Col. Muammar Qaddafi.

Qaddafi's decision also opened to Iran's military, at least potentially, the large quantities of Soviet equipment accumulated in Libya. U.S. officials say Qaddafi already has begun resupplying the Iranian war effort by air, along with North Korea. An unofficial israeli radio monitor reported that he detected Iranian jets flying between Libya and Iran on a roundabout path that took them through Greek, Bulgarian and Soviet airspace.

Meanwhile, the Iraqi Army, battling for control of Iranian territory along the Shatt-al-Arab waterway, claimed to have pushed an armored advance force across a river that had been a key obstacle in the drive to surround and capture the key Iranian cities of Khorramshahr and Abaden.

Washington Post correspondent William Claiborne reported from Baghdad that travelers arriving in the Iraqi capital from the south saw at least 400 heavy trucks with troops and military equipment, including tanks and armored personnel carriers, massing near Khorramshahr for wht some observer predicted would be a major offensive in the next few days. [Details on Page A22.]

In the U.N. General Assembly last night, Iranian delegate Ali Shams Ardakani called for world condemnation of the "aggressor" Iraq and said the United States is supporting Baghdad. Having lost influence in Iran, the United States "has opted for another policeman" in the Persian Gulf to replace the late shah, he said.

Although Ardakani affirmed Iran's new desire to participate in the Security Council debate, expected to resume on Monday, some members said he asked for a delay to prepare his statement. Other Council sources quoted by Reuter news agency said Ardakani might be awaiting Iranian counterattacks to strengthen his hand.

Iranian planes quickened the pace of the air war, striking at seven cities in Iraq in apparent retaliation for an Iraqi ground-to-ground missile attack Thursday. Iranian authorities said the salvo on two cities left more than 170 persons killed and about 300 wounded.

The Iranian jets, mostly U.S.-made F4 Phantom fighter-bombers, killed 13 persons and wounded 11 in raids on oil installations at Mosul, Kirkuk and Suleimanieh across a 160-mile arc in northern Iraq, a communique in Baghdad reported. Antiaircraft batteries shot down five Iranian planes, it said, including one that plummeted onto a house and killed a woman and a child.

In Baghdad, a Foreign Ministry spokesman said the Iraqi government is breaking relations with Syria, Libya and North Korea. He accused the three countries of supporting the Iranian war effort by sending supplies. The Syrian and Libyan diplomats reportedly were given 48 hours to leave the country and the North Koreans 72 hours.

In Tehran, the Iranian command said its warplanes hit oil wells and storage tanks in all three Iraqi cities, along with others in Irbil, Shuaibeh, Amareh and Basra.

President Abol Hassen Bani-Sadr implicitly warned in an interview on Iranian radio and television that Iran may attack civilian targets if Iraq continues missile strikes such as the one Thursday said to involve large Soviet-supplied Scud ground-to-ground missiles.

"If these missiles continue, the Iranian government will be forced to ask the people to evacuate the cities, which Iraq has turned into its bases, so that we can answer back," the Iranian presdident said.

In a similar vein, the official Iraqi radio broadcast a warning to Iranian civilians that other missile attacks might be launched on Ahwaz and Dezful, key Iraqi goals about 60 miles inside Iran.

"In order not to be harmed by surface-to-surface missiles and to be safe from heavy bombs dropped by aircraft, which hav not been used so far, leave your cities immediately," it said.

Baghdad said its Soviet-made Migs attacked Iranian targets near the besieged cities of Khorramshahr and Abadan on the disputed Shatt-al-Arab wateway and destroyed "enemy concentrations" between Dezful and Ahwaz, 50 miles northeast of the two embattled Shatt-al-Arab ports. The two regions have been the center of the ground war -- fought mostly by artillery barrages -- since hostilities erupted Sept. 22 between the two OPEC neighbors.

Despite nearly three weeks of pounding with artillery and air attacks, Iraqi forces have so far been unable to dislodge diehard Iranian defenders from Khorramshahr city center and move on toward the giant Iranian oil refinery at Abadan, about 10 miles down the Shatt-al-Arab toward the Persian Gulf.

Qaddafi's support of Iran seemed paradoxical at first glance against the background of his strong pan-Arab stand. But on closer look, it fit in with the zealous brand of Islamic revolution that the Libyan leader has advocated since he assumed power in a bloodless military coup in 1969.

"It is the Islamic duty that we, the Arabs, should align ourselves with the Moslems in Iran . . . rather than fight them on behalf of the United States," Qaddafi said in identical telegrams to King Khalid of Saudi Arabia and other Persian Gulf rulers, distributed by the official Libyan news agency JANA.

Qaddafi urged Saudi Arabia to send back the four AWACS early-warning planes sent by the United States to provide the Saudis with increased protection against any attack on their territory by Iran. He said the planes represented an "expansion of the U.S. military presence" in the Arab world and he threatened to fight back through "the masses" if the Saudi royal family failed to heed his concern.

Observers noted that, whatever Qaddafi's motives, the result of his move was to put the two most radical Arab states ranged against Israel -- Libya and Iraq -- on opposite sides in a war that seemed to be altering the Arab lineup in several ways. Besides the Libyan declaration, King Hussein of Jordan has energetically supported Iraq, while his neighbors and former close allies in Syria have attacked the Iraqi leadership for its conduct of the war.

In New York, U.N. Secretary General Kurt Waldheim appealed to both Iran and Iraq to conclude "at least a local cease-fire" to allow ships to leave the scene of hostilities safely. In messages to the presidents of the two countries, Waldheim expressed "deep concern" about casualties and damage incurred by international shipping.

Elsewhere, Saudi Arabia and its Persian Gulf neighbors have backed their fellow Arabs in Iraq, while at the same time asking the United States for additional demonstrations that it is ready to protect them militarily should the hostilities spread. Some U.S. diplomats expressed hope that the crisis could even prompt the Saudi leadership to rethink its opposition to President Anwar Sadat of Egypt, whose air bases would be vital to any U.S. effort to defend Saudi soil.

There was little indication how much practical help Qaddafi's support would prove to be for the Iranians. The Libyian leader frequently has spoken out with bravura without taking the concrete steps necessary to turn his oratory into fact.

Although most Iranian military equipment is American-made, the late shah also acquired Soviet artillery and armored personnel carriers for which Qaddafi's arsenal could provide ammunition, U.S. sources suggested. Reports from pro-Iraqi sources in Beirut cited by the Associated Press said the Libyan shipments included SAM7 heat-seeking surface-to-air missiles.