MOSCOW, MARCH 2 -- A Soviet official acknowledged today that ethnic rioting in the Azerbaijan city of Sumgait over the weekend had resulted in a number of fatalities. Unofficial sources put the death toll at 17.

Foreign Ministry spokesman Gennadi Gerasimov told reporters that "several" people had died in the disturbances but said he did not know the exact figure.

Sergei Grigoryants, editor of the unofficial Soviet journal Glasnost, said 17 had died and 70 had been seriously injured. All of the dead were ethnic Armenian, Grigoryants said in an interview, quoting sources he had reached by telephone in Sumgait. Neither the death toll nor the nationality of the victims could be confirmed officially.

A criminal investigation into the violence in Sumgait is under way, Gerasimov said.

The news of deaths in Sumgait, coupled with Soviet acknowledgement yesterday that troops and armored personnel carriers had been summoned to quell the disturbances there, indicate that it was one of the bloodiest ethnic clashes ever in the Soviet Union.

With a strictly policed curfew in effect in Sumgait but demonstrators defiantly continuing an ethnic protest in another part of Azerbaijan days after leader Mikhail Gorbachev appealed for calm, the Kremlin apparently is studying how seriously it needs to crack down to keep nationalities under control.

In the Nagorno-Karabakh region of Azerbaijan, where the Armenian majority touched off the wave of ethnic demonstrations early last month, a senior Soviet official reportedly issued an ultimatum to protesters yesterday, demanding that they back down from demands that they be united with Armenia.

Gerasimov told journalists yesterday that a "rolling demonstration" was taking place in the Nagorno-Karabakh capital, Stepanakert, with demonstrators taking turns in the protest there, now in its third week.

Gerasimov has suggested that the protests in the Caucasus region apparently stemmed from "mistakes made in national relations" in 1923, when the Nagorno-Karabakh area was incorporated into Azerbaijan.

The Nagorno-Karabakh demonstration touched off a solidarity protest in the Armenian capital, Yerevan, that drew more than 100,000 before it was suspended on Saturday to give the Soviet leadership time to resolve the problem.

Today, an Armenian activist in Yerevan said that the protests are continuing there despite the appeals by Gorbachev and other party officials.

A radio report in Baku, the capital of Azerbaijan, said yesterday that a commission had been established to help Azerbaijanis who fled Armenia because of the disturbances return to their homes. The report said it was not known how many Azerbaijanis had fled.

The disturbance between Azerbaijanis and Armenians in Sumgait, which took place one day after the protest was suspended in Yerevan, was led by "hooligans" who incited local youths to follow them, according to today's edition of Bakinskii Rabochii, an Azerbaijani party newspaper. The group led a street rampage against Armenians, according to Sumgait sources reached by telephone.

Sumgait, a city of 223,000 near Baku, is believed to have a sizable minority of Armenian residents.

Some of the rioters in Sumgait have been detained, Bakinskii Rabochii said.

The riots have brought to the surface deep-seated bitterness between two rival ethnic groups that has existed for decades and been left to smolder by past Kremlin policies of benign neglect toward the Soviet nationalities problem.

In a country that includes at least 17 major ethnic groups, many of whom have also been embroiled in nationalist tensions, further flare-ups could occur as Gorbachev carries out his nationwide reform that is intended to stamp out corruption and bring personnel changes and reconstruction in the ethnic-rich Asian areas and the Caucasus.

So far, the effect of the campaign on ethnic tensions has been ominous. When a Russian party leader was named to replace a Kazakh as party boss in the Central Asian republic of Kazakhstan in December 1986, riots broke out there, too.

Azerbaijanis and Armenians share a border of several hundred miles but seem to have little else in common. Armenians generally maintain a much higher standard of living and have forged closer ties to the West. Even the languages spoken by the two neighboring nationalities are different.

The most important difference between them is religion, however. Most Azerbaijanis are Shiite Moslems and share more cultural experiences with Moslems across the border in Iran than with Armenians, half of whom are believed to be practicing Christians.