MOSCOW, AUG. 29 -- The legislature of Soviet Armenia declared a state of emergency in the republic today after an eruption of violence between rival militia groups left at least five people dead, including one legislator.

The legislature also voted unanimously to ban the biggest independent paramilitary group in the Transcaucasian republic, the Armenian National Army, and ordered the group to give up its arms by tonight. Leaders of the private army, which operates out of heavily fortified headquarters in Yerevan, the Armenian capital, said they will not comply.

Armenian President Levon Ter-Petrossian said his government would use local KGB secret police and Armenian Interior Ministry troops to end the factional violence and that he hopes to avoid calling on the Soviet army, which is viewed with scorn in the republic.

Since the escalation of cross-border clashes with armed groups from the neighboring Soviet republic of Azerbaijan early this year, several independent Armenian militias have also begun fighting among themselves. The latest outbreak began Tuesday night when Armenian National Army members armed with automatic weapons attacked the headquarters of the Armenian National Movement, the leading nationalist organization in Armenia and a supporter of the republic's government.

This morning, Armenian National Movement spokesmen said, an official of their group, Gehavnik Manukyan, and a young legislator, Viktor Aivazian, were shot dead as they arrived with a large delegation at the National Army's headquarters to investigate reports of an attack on a gasoline station. The Armenian government newspaper said three more people were killed in fighting between the rival groups in a Yerevan square later in the day.

After announcing the death of Aivazian, Ter-Petrossian fired the republic's interior minister, Levon Galstyan, and ordered Armenian internal security troops to encircle Yerevan to prevent paramilitary troops in the countryside from provoking further violence.

In a radio address broadcast throughout the republic, Ter-Petrossian appealed for calm, imposed a 10-p.m.-to-6-a.m. curfew and declared that Armenia "could no longer bear the adventurism of these armed detachments, which endanger the security of our citizens and the formation of our statehood."

Ter-Petrossian, who led the legislature this month to declare the republic's independence from Moscow, has assured Soviet President Mikhail Gorbachev that he will put an end to the militia problem independent of Kremlin authority.

Gorbachev, who announced in July that he intended to use army troops against independent militias that did not surrender their arms voluntarily, gave Ter-Petrossian a two-month extension -- until early October -- to bring the situation under control. Many Armenians are convinced that the intervention of Soviet army troops would lead to widespread rebellion and bloodshed.

One article of Armenia's declaration of independence declares the republic's right to create its own armed forces. And Ter-Petrossian is still hoping that with his personal authority as a respected Armenian nationalist he will be able to use that new army to eliminate the ragtag militias that continue to engage armed Azerbaijani groups along the border with battlefield missiles, machine guns and grenades stolen from Soviet army caches. So far the new, official Armenian military force, administered by the republic's Interior Ministry, has about 2,000 troops.

Most estimates of the number of independent militia members average about 10,000, while Ter-Petrossian says there are about 5,000.

The Soviet news agency Tass said the banned Armenian National Army comprises "a variety of armed groups, some of which are criminal gangs that rob compatriots and stage provocative activities on the border with Azerbaijan under the cover of the struggle for ethnic identity."

The news agency said there are frequent attacks on police and army patrols by militias trying to capture new arms. Soviet television now frequently shows footage of Armenian paramilitary troops firing rockets at Soviet army helicopters and at Azerbaijanis across the border.

An Armenian National Army spokesman told the Reuter news agency: "We have no intention of disarming by the deadline. We hope to start negotiations with the parliament in order to stop the fratricidal bloodshed."

The level of violence in the Soviet Transcaucasus has grown steadily since February 1988, when Armenians began public protests demanding control over the mountainous enclave of Nagorno-Karabakh. Azerbaijan, which is predominantly Moslem, has controlled Nagorno-Karabakh since the 1920s, although about 70 percent of its residents are Christian Armenians.

After about 30 Armenians were killed during ethnic rioting in the Azerbaijani oil city of Sumgait in February 1988, relations between the two republics grew sharply worse, culminating in a virtual civil war early this year.