Armenian legislators rejected Friday political changes sought by President Mikhail S. Gorbachev and demanded annexation of a part of neighboring Azerbaijan, residents said.

The legislative session came as more than 2,000 ethnic Armenians streamed into Armenia from Azerbaijan, panicked by ethnic rioting there that killed three soldiers and left more than 126 people injured earlier this week.It was the worst outbreak of violence since February in the Caucasus, where tensions have run high because of a bitter territorial dispute over Nagorno-Karabakh, a predominantly Armenian enclave inside Azerbaijan.

The legal status of the decisions made by about 200 of Armenia's 340 Supreme Soviet members was uncertain, but Armenian activists called the session a victory for democracy. Residents said the legislators met in their capital's Opera Theater until 2 a.m. Friday.

In Azerbaijan, the chief of information for the Azerbaijan Foreign Ministry said the situation in the republic's capital, Baku, remained tense and that industries in the Caspian Sea port city were closed by strikes.

The official, Musa Mamedov, speaking by telephone from Baku, said soldiers had cordoned off the city's Armenian districts but that for safety's sake, "nobody is going there."

Gennady I. Gerasimov, the Soviet Foreign Ministry spokesman, said in Moscow on Thursday that tanks and troops were sent to restore order in Baku and the two Azerbaijan cities where rioting flared Tuesday, Kirovabad and Nakhichevan.

Ruben Karagosyan, chief editor of Armenia's official Armenpress news agency, said by telephone from Yerevan, the republic's capital, that a curfew was imposed there Thursday night.

Karagosyan said 2,200 ethnic Armenians who fled the violence in Azerbaijan had been registered as refugees by a newly created Armenian government commission. The republic allocated $2.8 million in aid, he said.

The Armenian Supreme Soviet, or legislature, broke off its regular fall session Tuesday after a Kremlin envoy, Arkady Volsky, said the situation in the Caucasus had become too enflamed to proceed. The lamwakers had been scheduled to debate the Nagorno-Karabakh issue.

About 200 deputies resumed the session Thursday night, enough members for a quorum, said Victoria Manukyan, chief of local news for Armenpress.

Manukyan gave no details on the decisions reached. But Rafael Popoyan, an Armenian activist, said the deputies again demanded unification of Nagorno-Karabakh with Armenia and rejected the constitutional changes proposed by Gorbachev.

"They decided that the constitutional amendments do not correspond to the interests of Armenia or of democracy and demanded that new proposals be drawn up in two months that will meet those criteria," Popoyan said from Yerevan.

The meeting in the opera house took place in the absence of Armenia's president and top local Communist Party officials, but Samson Tonoyan, chairman of the Supreme Soviet, led the session, Popoyan said. He said Tonoyan announced the decision to a crowd after the meeting.

Gorbachev's amendments have provoked strong criticism, especially in the Baltic republics, where activists argue they would strengthen Moscow's powers at the expense of the 15 Soviet republics and eliminate the republics' right to secede. The legal changes are to be voted on by a special Nov. 29 session of the national Supreme Soviet.

The parliaments of Estonia, Latvia and Georgia have demanded changes in the Gorbachev proposals, and Lithuania has rejected them.

Both Azerbaijan and the Soviet leadership have rejected any change in sovereignty for Nagorno-Karabakh.

In February, ethnic riots broke out in the Azerbaijan city of Sumgait, and at least 32 people, including 26 Armenians, were killed.

Azerbaijanis said the latest unrest was caused by an illegal building project carried out by Armenia in Nagorno-Karabakh as a purported attempt to reinforce the Armenian majority there.