MOSCOW, AUG. 8 -- The aggressive protests here recently by Crimean Tatars -- and the Kremlin's shifting, uncertain response -- have suggested that long-suppressed demands by national and ethnic groups, nudged to the surface by Soviet leader Mikhail Gorbachev's commitment to glasnost, or openness, may prove to be one of the most severe tests of that commitment, western diplomats and Soviet activists say.

Official tolerance of free expression has been tested in recent months by groups that included dissidents seeking to establish independent publications, Hare Krishnas and self-styled hippies.

But the nationalist demonstrations induced by Gorbachev's policy have posed the most serious challenge to the order and structure of the Soviet state.

The trend began dramatically late last year when Kazakhs rioted in the central Asian city of Alma Ata after the replacement of the Kazakh Socialist Republic's long-time party boss, a Kazakh, by a Russian. Since then there have been at least three other nationality-based protests, all reflecting deep popular feelings.

The variety of manifestations suggests the long list of grievances Soviet leaders could face if nationalist demonstrations spread. Thousands of Latvians reportedly demonstrated June 14 in Riga to protest the 1940 Soviet annexation of Latvia and two other Baltic countries, Estonia and Lithuania.

In May, Russian nationalists marched in Moscow to publicize an agenda that mixes concern for the environment and historic monuments with antiwestern and anti-Semitic ideas and demands for political orthodoxy antithetical to Gorbachev's reform program.

Finally, the Tatars arrived here last month from central Asia, calling on Gorbachev to restore the Crimean homeland from which they were deported by Joseph Stalin in the 1940s at the cost of thousands of lives.

"The authorities have to be concerned that if the Tatars can demonstrate, if the Kazakhs can demonstrate in Alma Ata, how many demonstrations are they going to have?" said a diplomat. "How big is it going to get?"

Some western and Soviet observers here said the Kremlin may have seen only the beginning of the national problems. While greater openness inevitably means allowing a certain amount of nationalist feeling to surface, Gorbachev's economic and cultural policies could aggravate the trend, these analysts said.

Leonid Brezhnev, who kept nationalism in check during his 18-year rule, "was the great compromiser among minorities," observed one western expert.

"Every group got its share of the money and the patronage," he explained. "But Gorbachev has real problems because he wants to spend money where it's most effective and to choose the best managers regardless of background."

The reform drive will inevitably mean cutting back the flow of resources to less-developed republics dominated by ethnic minorities in ways that could quickly arouse resentment, the diplomat said. Moreover, Gorbachev's emphasis on promoting use of the Russian language in outlying republics, while important for efficiency, also may have stirred bitter feelings.

Above all, the Tatars' case suggested that Gorbachev's deputies lack the experience and flexibility to handle nationalist movements without repression. The protesters, in turn, have shown that they remain reluctant to trust officials.

The apparent desire of the Soviet leadership to show more tolerance and respect for dissenters was evident as authorities first acknowledged that complaints by the Tatars were legitimate, then allowed them to demonstrate at the Kremlin walls.

Yet the Tatars' activities and the precedent they could be setting for other groups clearly troubled the Communist Party and its security apparatus. On July 30 the authorities cracked down on the protesters, expelling their leaders from Moscow and blaming U.S. diplomats for instigating the campaign.

For western observers, this reversion to heavy-handed police and propaganda tactics, prompted in part by the Tatars' relentless militancy, reflected the degree to which official policies can oscillate between Gorbachev's liberalism and what he calls "old thinking." But the turnaround also pointed to the government's failure to formulate a coherent approach to the containment of nationalism.

"Obviously the regime is trying to deal with the situation where they open to some degree and yet keep it under control," said a senior western diplomat. "In some degree they are feeling their way. I think they are aware that they are sitting on a lot of grievances, and if they let them start bubbling to the surface it's going to cause problems."

Soviet authorities gave what they thought was an adequate response to the Tatars' demands last month by naming a commission headed by President Andrei Gromyko to study their problems. Later, after many of the 800 Tatars who traveled to Moscow demonstrated in Red Square, their leaders met with Gromyko.

Yet diplomats and supporters of the Tatars noted that the government failed to name any of the visiting group to the commission and provoked the protesters with harsh media attacks charging that Tatars collaborated with the invading German Army during World War II.

"They didn't send them away to prison or psychiatric hospitals like what might have happened before, but on the other hand they poisoned the atmosphere against them," said Sergei Grigoryants, editor of the unofficial journal Glasnost and a first-hand observer of the Tatars' campaign. "In a multinational country like the Soviet Union, to try and create animosity among nationalities is a very dangerous policy."

The errors in official handling and propaganda, Grigoryants and other observers said, may have helped prompt the Tatars to elect an "initiative group" of mostly young, militant leaders and to reject Gromyko's request that they leave Moscow and end their protests.

That stubbornness, in turn, appeared to prompt the police crackdown last week and an eventual standoff between security forces and Tatar leaders, who reportedly barricaded themselves inside a Moscow apartment. Dissident sources said the activists hung a banner from the apartment balcony reading, "Tass, stop slandering the Tatars," in reference to the official Soviet news agency.

Police eventually broke down the door to the apartment and dragged away the activists one by one, the sources said. The group was taken to the airport and put on planes for home. The apparent leader of the group, Becker Umerov, was warned that he might be arrested, according to the unofficial accounts.

"It's tragic in a way because the authorities clearly wanted to handle this differently," a western diplomat concluded. "But there was a lack of trust on both sides that couldn't be overcome."