Nigerian troops have repelled a Boko Haram attack the city of Gombe, officials say.
Soldiers and a fighter jet were used in a counter-attack after Islamist fighters overran a checkpoint on the edge of the city.
The insurgents were retreating towards their stronghold in the neighbouring state of Borno, witnesses said.
Before the militants left, they scattered leaflets urging people not to vote in the elections.
All roads in and out of Gombe have been blocked and a 24-hour curfew imposed, reports the BBC’s Abdullahi Kaura Abubakar in Abuja.
Gombe – capital of Gombe State – has previously suffered suicide attacks but correspondents say this was the first time Boko Haram launched a direct assault on the city.
Reports said militants first attacked the town of Dadin Kowa, about 40km (25 miles) from Gombe.
Ground troops with air support then battled to keep the insurgents from entering the city, as residents fled into the bush and nearby hills.