image copyrightState Houseimage captionMr Buhari was re-elected for a second four-year term in 2019
Nigeria's President Muhammadu Buhari has admitted that he has failed to end insecurity in the country, a promise he made when he was elected in 2015.
In a TV address, he said the fight against Islamist militants in the north had had the unintended consequence of spreading violence to other areas.
Mr Buhari extended his "heartfelt condolences" to families of victims.
The Boko Haram Islamist group, which began its insurgency in 2009, has stepped up attacks in recent months.
After his election in 2015, President Buhari said the group had been "technically defeated" by an army offensive.
But there have been dozens of attacks in the north-east since the start of the year, and a number of military bases as well as towns have been overrun by the militants. Weapons, food and medicines have also been looted.
- Why Nigeria has failed to defeat Boko Haram
- Who are Nigeria's Boko Haram?
- Dead or alive? The six lives of Boko Haram's leader
In his address marking Democracy Day on Saturday, President Buhari said the past two years had seen "challenges that would have destroyed other nations, especially relating to our collective security".
Referring to the attacks and kidnappings that have spread to north-west and central Nigeria, he said: "Unfortunately, like most conflict situations, some Nigerian criminals have taken advantage of a difficult situation".
He expressed his condolences to "families and friends of our countrymen, women and children who have been the unfortunate victims of such senseless kidnappings and murders".
image copyrightAFPimage captionMr Buhari's government has been under fire over growing insecurity
The president said he would do "everything in [his] power to ensure security".
The speech came as some Nigerians gathered for nationwide protests over issues of insecurity.
In recent times, security forces have attacked protesters and many have accused the government of trying to prevent criticism.
Key protest organisers have often been targeted and arrested.
media captionBoko Haram has been active in northern Nigeria for more than a decade
Boko Haram at a glance:
- Founded in 2002
- Initially focused on opposing Western education
- Launched military operations in 2009
- Gained attention in 2014 with Chibok kidnappings
- Pledged allegiance to Islamic State in 2015
- Split into two factions in 2016
Over the past year the army has been withdrawing troops from smaller bases in the north-east to focus on large sites known as Super Camps.
However, it has left vast swathes of rural communities unprotected, analysts say.
There are concerns that armed criminal gangs in other parts of the country are forging links with the militants.
And last December, then army chief Lt Gen Yusuf Tukur Buratai suggested that the fight against Boko Haram could continue for another 20 years.