Who are Nigeria's Boko Haram Islamist group?
Nigeria's militant Islamist group Boko Haram - which has caused havoc in Africa's most populous country through a wave of bombings, assassinations and abductions - is fighting to overthrow the government and create an Islamic state.
Boko Haram promotes a version of Islam which makes it "haram", or forbidden, for Muslims to take part in any political or social activity associated with Western society.
This includes voting in elections, wearing shirts and trousers or receiving a secular education.
Boko Haram regards the Nigerian state as being run by non-believers, regardless of whether the president is Muslim or not - and it has extended its military campaign by targeting neighbouring states.
The group's official name is Jama'atu Ahlis Sunna Lidda'awati wal-Jihad, which in Arabic means "People Committed to the Propagation of the Prophet's Teachings and Jihad".
Resisting British rule
But residents in the north-eastern city of Maiduguri, where the group had its headquarters, dubbed it Boko Haram.
Loosely translated from the region's Hausa language, this means "Western education is forbidden".
Boko originally meant fake but came to signify Western education, while haram means forbidden.
Boko Haram at a glance
- Founded in 2002
- Official Arabic name, Jama'atu Ahlis Sunna Lidda'awati wal-Jihad, means "People Committed to the Propagation of the Prophet's Teachings and Jihad"
- Initially focused on opposing Western education
- Launched military operations in 2009 to create Islamic state
- Designated a terrorist group by US in 2013
- Declared a caliphate in areas it controlled in 2014
- Most territory now recaptured by army
Since the Sokoto caliphate, which ruled parts of what is now northern Nigeria, Niger and southern Cameroon, fell under British control in 1903, there has been resistance among some of the area's Muslims to Western education.
Many still refuse to send their children to government-run "Western schools", a problem compounded by the ruling elite which does not see education as a priority.
Against this background, charismatic Muslim cleric Mohammed Yusuf formed Boko Haram in Maiduguri in 2002. He set up a religious complex, which included a mosque and an Islamic school.
Many poor Muslim families from across Nigeria, as well as neighbouring countries, enrolled their children at the school.
But Boko Haram was not only interested in education. Its political goal was to create an Islamic state, and the school became a recruiting ground for jihadis.
In 2009, Boko Haram carried out a spate of attacks on police stations and other government buildings in Maiduguri, capital of Borno state.
This led to shoot-outs on Maiduguri's streets. Hundreds of Boko Haram supporters were killed and thousands of residents fled the city.
Nigeria's security forces eventually seized the group's headquarters, capturing its fighters and killing Mr Yusuf.
His body was shown on state television and the security forces declared Boko Haram finished.
But its fighters regrouped under a new leader, Abubakar Shekau, and stepped up their insurgency.
In 2013, the US designated it a terrorist organisation, amid fears that it had developed links with other militant groups, such as al-Qaeda in the Islamic Maghreb, to wage a global jihad.
Boko Haram's trademark was originally the use of gunmen on motorbikes, killing police, politicians and anyone who criticised it, including clerics from other Muslim traditions and Christian preachers.
The group then began to carry out more audacious attacks in northern and central Nigeria, including bombing churches, bus ranks, bars, military barracks and even the police and UN headquarters in the capital, Abuja.
Amid growing concern about the escalating violence, the government declared a state of emergency in May 2013 in the three northern states where Boko Haram was strongest - Borno, Yobe and Adamawa.
It draws its fighters mainly from the Kanuri ethnic group, which is the largest in the three states. Most Kanuris have distinctive facial scars and when added to their heavy Hausa accents, they are easily identifiable to others Nigerians.
As a result, the militants operate mainly in the north-east, where the terrain is also familiar to them.
The deployment of troops and the formation of vigilante groups drove many of them out of Maiduguri, their main urban base and they retreated to the vast Sambisa forest to the south and the Mandara Mountains, close to the border with Cameroon.
From there, the group's fighters launched mass attacks on villages and towns, looting, killing, abducting women and children and conscripting men and boys into their army.
In April 2014, Boko Haram drew international condemnation by abducting more than 200 schoolgirls from Chibok town in Borno state, saying it would treat them as slaves and marry them off - a reference to an ancient Islamic belief that women captured in conflict are considered war booty.
And it switched tactics, starting to hold on to territory rather than retreating after an attack.
In August 2014, Mr Shekau declared a caliphate in areas under Boko Haram's control, with the town of Gwoza its seat of power.
"We are in an Islamic caliphate," said Mr Shekau, flanked by masked fighters and carrying a machine gun. "We have nothing to do with Nigeria. We don't believe in this name."
Later, Mr Shekau formally pledged allegiance to the Islamic State (IS) group, turning his back on al-Qaeda.
IS accepted the pledge, naming the territory under Boko Haram's control as the Islamic State of West Africa Province and as being part of the global caliphate it was trying to establish.
But by March 2015, Boko Haram had lost all the towns under its control as a regional coalition - made up of troops from Nigeria, Cameroon, Chad and Niger - was formed to fight it.
Once again, Boko Haram retreated to the Sambisa forest, where the Nigerian military pursued it, freeing hundreds of captives.
In August 2016, the group apparently split, with an IS video announcing that Mr Shekau had been replaced with Abu Musab al-Barnawi, believed to be a son of Boko Haram's founder.
Mr Shekau disputed this, insisting he was still in charge.
And in a big surprise, 21 of the Chibok girls, seen as prized assets for Mr Shekau, were freed in October 2016 following talks involving the militants, the Nigerian and Swiss governments and the International Committee of the Red Cross.
But with Amnesty International saying that some 2,000 children remain in captivity, many more are still to be freed.
And while many fighters have been killed and weapons seized, some analysts say it is too early to write off Boko Haram.
Boko Haram has outlived other militant groups in northern Nigeria, and has built a presence in neighbouring states where it has carried out attacks and has recruited fighters.
It has a force of thousands of men - CIA officials have estimated around 9,000 - and cells that specialise in bombings. Through its raids on military bases and banks, it has gained control of vast amounts of weapons and money.
So, the chances of it being routed anytime soon - despite Mr Buhari's claim that it had been "technically defeated" - are slim, with the region's chronic poverty and poor education system helping it gain new recruits.