There were no immediate reports of casualties, but a police official said the attackers had burnt tyres on the road and set up makeshift roadblocks to ambush the convoy of more than 100 vehicles.
"The gunmen opened fire and also pelted stones," a police official in Tantirimale, 240 kilometres (150 miles) north of Colombo said. "At least two buses were hit, but we have no reports of casualties." Muslims from the coastal town of Puttalam were travelling to the neighbouring district of Mannar, where they were registered to vote, the police official said.
Police reinforcements rushed to the area and cleared the obstructions on the road and escorted the convoy so that passengers could cast their ballots.
The incident came as police and troops were locked in a tense standoff in the Tamil-dominated northern peninsula of Jaffna where residents complained of military roadblocks ahead of voting.
Police reported to the independent Election Commission that the army was illegally manning roadblocks that could discourage residents from freely travelling to polling booths on Saturday.
"After bringing to the notice of the army that the roadblocks were illegal at a time of a national election, they have dismantled them," police said in a statement. Police sources said they had also warned local military commanders that any disruption to the election would be reported to courts and offenders prosecuted.
Sri Lanka's minority Tamils and Muslims are seen as crucial to deciding a winner in a close contest between the two front runners — housing minister Sajith Premadasa and the opposition's Gotabaya Rajapaksa.
Local media reports have feared that a strong military presence in Jaffna, the heartland of the island's Tamil minority, could influence voter turnout and favour Rajapaksa, a former defence ministry chief and brother of former president Mahinda Rajapaksa.