* Boko Haram fighters have killed over 150 in the past week
* Islamists attack palace of traditional Islamic king
* Offensive against them has failed to curb violence (Recasts with Bama attack, witnesses, quotes, adds U.S. State Department comment, adds byline)
By Ibrahim Mshelizza
MAIDUGURI, Feb 19 (Reuters) - Gunmen from Nigeria's Boko Haram Islamist group attacked the northeastern town of Bama on Wednesday, opening fire on a school, shooting or burning to death 47 people and trashing the palace of a traditional ruler, officials and witnesses said.
The death toll was confirmed by Lawal Tanko, the police commissioner for Borno state, which lies at the epicentre of an Islamist insurgency that has killed thousands in the past four and half years. Many more were wounded, he said.
He added that the assailants had also partly burned down the palace of the traditional ruler of Borno, whose kingdom was one of West Africa's oldest medieval Islamic caliphates.
"Boko Haram came in at about 4.00 a.m. (0300 GMT), just when we were getting ready for the morning prayers," said Bama resident Abba Masta, who lives near the palace.
"There was shooting everywhere and they set the palace on fire. Many died. Students had to run for their lives as they attacked the government girls college as well."
It was one of several deadly attacks this week.
On Sunday the Islamists killed 106 people in Igze village, according to official figures, making it one of their deadliest assaults so far. That prompted the Borno state governor to say the rebels were better armed and motivated than government forces.
"The senseless targeting of innocent civilians is unacceptable," U.S. State Department spokesman for Africa Will Stevens said in Washington on Wednesday, referring to the Igze attack.
"We encourage Nigerian authorities to investigate this heinous act and to hold accountable ... those responsible."
The military denied Boko Haram were better armed or motivated and said it was making progress, but that no country facing terrorism had defeated it completely.
President Goodluck Jonathan ordered extra troops into northeast Nigeria in May to crush Boko Haram, which wants to create a breakaway Islamic state in the largely Muslim north, but the offensive, backed by air power, has so far failed.
The militants have retreated into the remote, hilly Gwoza area bordering Cameroon, from where they mount deadly attacks against civilians they accuse of being pro-government, and are abducting scores of girls - a new tactic eerily reminiscent of Uganda's cult-like Lord's Resistance Army in decades past.
Earlier on Wednesday, Boko Haram fighters attacked the house of an army general in the village of Buratai in Borno state, killing a soldier guarding it, Tanko said.
He said General Umar Tukur Buratai, who is stationed in the southern Niger Delta, was not there at the time of the assault, which had inflicted "minimal damage".
Jonathan faces an election in a year, with Boko Haram's persistence as the number one threat to Africa's top oil producer fuelling criticism that he has failed on security. (Additional reporting by Lesley Wroughton in Washington; Writing by Tim Cocks)