The gun battle erupted after the men refused to surrender their weapons, Russia's Federal Investigative Committee said.
The other four fighters died, and a policeman was injured, in a clash in the centre of Derbent overnight, local investigators said.
Fighters belonging to anti-government Muslim groups have been staging almost daily attacks in the North Caucasus - most of them in Dagestan, Ingushetia and Chechnya.
The region is the site of two separatist wars with Moscow since the mid-1990s.
Many want to carve out their own version of an Islamic pan-Caucasus state that is separate from Russia.
Twin suicide bombings on the Moscow metro in March which killed 40 people turned the global spotlight on the region.
Authorities blamed the attacks on two women from Dagestan.
Wednesday's attacks bring the total of deaths to at least 30 in June across the North Caucasus.
Late on Wednesday, Ramzan Kadyrov, Chechnya's leader, said at least one fighter was found dead after fighting in mountain woods in the region's south.
Though the Kremlin pours billions of dollars into the North Caucasus, where unemployment in some regions is as high as 50 per cent, government and religious leaders say many youths are still turning to join the revolt.