Helicopter gunships fired rockets into mountainous rebel redoubts. Frightened villagers fled their homes. Bearded Islamic guerrillas crept along steep ridges, rocket-propelled grenades at the ready.

The scenes were reminiscent of Russia's unhappy war in Chechnya--a rebellious southern region that has been independent in all but name since Russian troops pulled out three years ago--but they took place over the weekend in Dagestan, another restive Russian region that borders Chechnya.

Prime Minister Sergei Stepashin flew there today to organize a counterattack against "bandits" who Moscow says are infiltrators from Chechnya but who Chechen officials say are home-grown Dagestani rebels. Russian press reports said the raiders had occupied at least three villages in Dagestan and that 1,000 Russian policemen, Interior Ministry troops and soldiers had massed nearby. By evening, the reports said, a government helicopter and artillery assault had begun.

Low-level fighting between guerrillas and local security forces has been going on in Dagestan for two weeks; Moscow's weekend escalation and heightened rhetoric raise the possibility that the violence might boil into full-scale war.

Such a turn of events would present Russia's military with a stiff and unwelcome challenge, but it could also upset Russia's political calendar on the eve of the campaign for December's parliamentary elections and, a year from now, the vote to choose a successor to President Boris Yeltsin.

A war could offer the Kremlin a reason to cancel the balloting under a state of emergency. Yeltsin is confronted by powerful opposition alliances in the legislative campaign and has been unable to settle on a candidate to succeed him. "There will be war if Moscow wants it," said a Western diplomat here.

There is a bit of deja vu to the crisis. When Russia's offensive against Chechen rebels began in 1994, Stepashin was chief of the Federal Security Service, Russia's intelligence agency, and a chief instigator of the assault. Less than three years later, Russian troops retreated from Chechnya, and the two sides worked out an accord under which the province's final status would be worked out within five years. Russian officials say the Chechens now want to expand their self-proclaimed Islamic republic into Dagestan.

Stepashin said he would not shy away from a fight. "Some people seem to be scared by [a repeat of] 1994 and 1995," he told reporters. "I am not afraid." Gen. Anatoly Kvashnin, chief of general staff, said Russian police and military forces will try to evacuate civilians from the combat area and "deal with the bandits."

Television images of people fleeing the area suggest that the guerrillas have preempted any such plan. Women descending from trucks said their men were being held hostage by the invaders. One woman said the gunmen demanded money and jewelry; another said they predicted establishment of an Islamic republic in Dagestan.

Dagestan is a mountainous patchwork of ethnic and religious groups and clans bordered by Chechnya, Azerbaijan, Georgia and the Caspian Sea. It has been dangerous territory for months as raiders from Chechnya crept in to kidnap hostages for ransom. Russian troops have been fired on, suffering dozens of casualties.