By Ola Lanre and Ahmed Kingimi
MAIDUGURI, Nigeria (Reuters) - At least four people were killed in an attack by Boko Haram militants in northeastern Nigeria late on Thursday, the national emergency agency said, the second such clash in Maiduguri city in a month.
Five suicide bombers were also killed in the attack, which Nigeria's military said had been repelled by troops.
Blasts and gunfire were heard by residents in the city which is the capital of Borno, the state worst hit by an insurgency which has killed more than 34,000 people since 2009.
President Muhammadu Buhari, who took office in 2015 vowing to end Boko Haram's push to create an Islamic caliphate in the northeast, has made it a priority to improve security in Africa's most populous country.
The issue has become politically charged in the run-up to an election next year which Buhari said he wants to contest.
"There are five suicide bombers who died while trying to detonate IEDs (improvised explosive devices), there are also innocent citizens, four of them, that lost their lives," Bashir Idris Garga, the northeast Nigeria coordinator for the National Emergency Management Agency, said on Friday.
Boko Haram militants attempted to enter Maiduguri earlier this month, fighting soldiers in an attack in which at least 15 people were killed and 83 injured..
In the course of fighting the latest attack, the military said troops had been supported by the air force, police and other security agencies.
Witnesses had reported a heavy military presence and crowded streets as people attempted to flee to safety.
Hundreds of residents who fled the area Thursday night were returning home by the following morning, according to a Reuters journalist at the scene.
The signs of battle were still clear, with the charred body of a man among the tents in a camp for people displaced by the conflict, and an unexploded bomb dropped by the Nigerian air force lying nearby.
The government has been saying since December 2015 that the jihadist group has been defeated but high profile attacks in the last few months - including the kidnap of 111 schoolgirls from the town of Dapchi and a strike in the town of Rann that killed three aid workers - has shown the jihadists remain active.
Nigeria's government last month said it was in talks with Boko Haram, which split into two main factions in 2016, with the aim of securing a permanent ceasefire..
The government has not disclosed which elements of Boko Haram it is in discussions with and it was also not clear which faction carried out the latest attack.
(Reporting by Ola Lanre and Ahmed Kingimi; Additional reporting by Paul Carsten in Abuja and Tife Owolabi in Yenagoa; writing by Alexis Akwagyiram; editing by Larry King, Grant McCool, William Maclean)