Another 13 people were wounded in the Monday evening attack on a checkpoint outside a school in the city centre that the militiamen were using as a barracks, the sources said.
Militants attacked Samarra during a lightning offensive spearheaded by the Islamic State (IS) jihadist group in which they captured much of the Sunni Arab heartland north and west of Baghdad last June.
Signup to our newsletter and follow us on Facebook and Twitter!
But the mainly Sunni city houses a revered Shiite shrine, and troops and Shiite militia have so far successfully defended it.
Multiple Iraqi divisions wilted under the June onslaught, and Baghdad turned to Shiite militiamen, some of whom were involved in past sectarian violence, for support.
The 2006 bombing of the Al-Askari shrine in Samarra by militants of Al-Qaeda sparked a brutal sectarian conflict in which tens of thousands of people were killed.
Shiite pilgrims headed to the shrine from Baghdad and the south have come under attack by Sunni militants in recent months but the city itself has been largely spared the violence that has rocked other parts of Iraq.