The source said one policeman was killed and three wounded in an initial shootout and that another four were killed when additional troops sent to combat the militants came under attack.
"At about 14:00 Moscow time (10:00 GMT) a column of riot police was hit by an explosion, and unknown attackers then opened fire at it from a nearby wood. As a result of the attack, four servicemen died at the scene, while six sustained serious injuries and were taken to a local hospital," the source said.
He also said an operation had been launched to find the gunmen.
The incident took place some 30 km (19 miles) southwest of Makhachkala.
Militant attacks are common in Russia's North Caucasus republics. Neighboring Ingushetia has seen a marked rise in militant activity of late.
Add to blog
You may place this material on your blog by copying the link.
Image Galleries: International Chefs Day 2014: 'Pass It On!'
Infographics: Nobel Peace Prize
During the 11th Annual Meeting to be held in Sochi from October 22 to 24, experts of the Valdai International Discussion Club will focus on whether the global community will develop ground rules for the world politics or whether it will be a game without any rules where everyone fend for themselves.