(Reuters) - Heavily armed Boko Haram militants attacked the northeastern Nigerian city of Gombe on Saturday but were later repelled, a government security source said.

Earlier, explosions and gunfire could be heard after the fighters overwhelmed a checkpoint at the edge of the city, which has been bombed before but has never had the insurgents attempt to take it over.

Witness Abdul Hassan said soldiers had run away after the checkpoint was overwhelmed. The militants then burned down a police station on the outskirts of town, he said.

"I crossed a river and ran into the hills," he said. "I'm still there and I can hear the fighting."

Others were staying indoors. Witness Hussaina Maji said she was unable to leave her house for fear of being caught in crossfire.

Boko Haram's struggle for an Islamic state has become the gravest security threat to Africa's biggest economy and top oil producer, killing thousands, kidnapping hundreds and increasingly threatening neighbors Cameroon, Chad and Niger - all of which are now also battling the insurgents.

Nigeria has postponed a presidential election that had been due on Saturday, for six weeks, citing the security threat from Boko Haram.

Boko Haram attacked a village in Chad on Friday, the first known lethal attack in that country by the Nigerian militant group, which killed several people including a local chief according to residents and security forces.

(Reporting by Isaac Abrak and Ardo Abdallah; Editing by Toby Chopra)