"Two masked militants in camouflage entered the roadside cafe located on the Makhachkala - Buynaksk road [to the east of the republic's capital Makhachkala] on Sunday and opened gunfire on five of its guests," the source said.
The head of Dagestan's Untsukulsky district, Kazimbe Akhmedov, his two bodyguards, a local police officer and the director of a care home were killed in the attack.
Earlier reports said four people had been killed.
The source said the visitors were celebrating the birthday of Omar Omarov, Buynaksk region's prosecutor. "Omarov had left the cafe by that time," the source said.
The cafe owner was injured in the attack and hospitalized, the source said. The militants also stole a police weapon. A search for them is underway.
Sporadic terrorist attacks and militant clashes are common in the Russian republics of Ingushetia and Daghestan, and in neighboring Chechnya, although the Kremlin has ended its campaign to fight separatists and terrorists there.