MOSCOW, FEB. 29 -- The official Soviet news agency Tass reported today "rampage and violence" in a city in the republic of Azerbaijan, apparently touched off by two weeks of ethnic protests. Armenian nationalists in a majority-Armenian enclave of Azerbaijan are seeking to reunify their district with the neighboring Armenian republic.

The latest disturbances took place yesterday in Sumgait, an industrial city of about 160,000 population on the Caspian Sea.

The Sumgait clash appeared to illustrate the volatility of religious conflict in officially secular Soviet society and particularly in the southern Moslem republics located near the Islamic fundamentalist state of Iran.

Tass said the outbreak was provoked by "a group of hooligans," and that "rampage and violence followed." It gave no details but said authorities took steps to prevent further disturbances, widely interpreted as an indication that militia reinforcements had been sent in.

"Measures have been adopted to normalize the situation in the city and safeguard discipline and public order," the agency said.

The Sumgait riots were the third protest reported in the region in two weeks and the second in which violence was specified. Coming two days after Communist Party leader Mikhail Gorbachev appeared on television with an appeal for calm in Azerbaijan and Armenia, the street violence was interpreted here as a challenge to his authority.

Gorbachev's broadcast throughout both republics Friday, highlighted by a call for "reason and common sense," led leaders of major protests to suspend the demonstrations for a month.

A major element in the ethnic clashes pitting Armenians against Azeris is the contested, currently Azerbaijani (or Azeri), region of Nagorno-Karabakh -- where the first reported violence occurred.

The earlier protests were staged by Armenians to demand that the predominantly Armenian Nagorno-Karabakh region be reunited with the Armenian Republic. Ethnic Armenians, largely Christian, make up at least 75 percent of the Delaware-sized region's population of about 100,000. Most of the rest are Shiite Moslem Azeris. Azerbaijan took in the area, at Moscow's behest, in 1923. Russia took the region from Persia, now Iran, in 1813.

The street fighting in Nagorno-Karabakh reportedly has stopped. The situation in Armenia's capital, Yerevan, is also back to normal according to sources there reached by telephone. The streets of Yerevan, where three days ago tens of thousands rallied, are now calm, the sources said. Stores and factories stalled by the mass protests were now working normally, they added.

One hint that the Sumgait violence may have been inspired by the earlier demonstrations is that it occurred on the same day as the radio announcement that ethnic clashes between Azeris and Armenians in Nagorno-Karabakh had resulted in deaths.

In an interview on Baku radio, prosecutor Alexander Katusev said that "isolated hooligan elements" had instigated disturbances in Nagorno-Karabakh and that two youths "had fallen victim to murder" in clashes between the two ethnic groups there. "Several people suffered bruises, beatings and injuries that did not threaten their life and health," he said.

Whether the Sumgait disturbance was instigated by the earlier squabbles or not, religious differences seem to be at the root of the outbreaks. The Shiite Azeris and Christian Armenians have clashed sporadically for years, according to residents.

Moslems are one of the biggest groups in the Soviet Union, numbering about 45 million in a country of 275 million. Authorities have sought to exercise political control over them by introducing communist doctrines into their religious rituals.

The Kremlin also has tried to keep fundamentalism from creeping into the Soviet Union by maintaining tight patrols along its southern border while striving to improve relations with Iran and other Moslem-dominated states in the region.

Nonetheless, radio broadcasts urging Moslem solidarity are regularly beamed in from Iran and Pakistan.