Nigeria confirmed terrorists had massacred at least 41 children and a teacher at a boarding school in the country's insurgent-plagued north-east.

Gunmen thought to be loyal to the al-Qaeda-linked Boko Haram movement descended on the government secondary school in Mamudo on Saturday, spraying it with bullets and using petrol to burn some pupils alive.

At the regional morgue, Musa Hassan, 15, recalled the horror of listening to the death cries of his fellow pupils.

''We were sleeping when we heard gunshots. When I woke up, someone was pointing a gun at me,'' he said. He put his arm up in instinctive self-defence, and suffered a gunshot that blew off all four fingers on his right hand.

He said the gunmen came armed with jerry cans that they used to torch the school's administrative block and one of the hostels.