* Military struggling to stem Islamist insurgency in north
* President facing political crisis, mass defections
* Nigeria to hold hotly contested elections next year
* Jonathan critics fear he will break presidency rotation
* Financial markets remain calm
By Joe Brock and Tim Cocks
ABUJA, Jan 16 (Reuters) - Nigerian President Goodluck Jonathan replaced his entire military leadership on Thursday after serious setbacks in the struggle against an Islamist insurgency, and he lost a close political ally who quit as crisis grips the ruling party.
The presidency announced the removal of the chiefs of defence, army, navy and air force and named their successors without explanation.
However, a presidency source said Jonathan wanted to score some visible successes against the Boko Haram sect, which is trying to create an Islamic state in northern Nigeria, before what are expected to be closely contested elections next year.
As Jonathan asserted his military authority, top political ally Bamanga Tukur resigned as chairman of his People's Democratic Party (PDP), which is in crisis largely over the president's assumed intention to run for another term in 2015.
Armed forces chiefs appear to have lost their jobs over attempts to subdue the militants which are going badly.
On Dec. 2 Boko Haram gunmen stormed the air force base and military barracks around the airport of the northeastern city of Maiduguri. The group was also suspected of being behind a car bomb in the city this week which killed 29 people and wounded dozens more.
"I think this is performance-related," a security expert in Nigeria said. "The security teams haven't had a glowing record recently. The air force base attack was shocking."
Boko Haram has waged a four-year insurgency which has killed thousands in the religiously mixed country of 170 million, and has become the biggest security threat in Africa's top oil exporter and second largest economy.
Jonathan is also under heavy pressure politically. In December, his former mentor and two-time Nigerian president Olusegun Obasanjo wrote a scathing letter telling him not to run again and copying it to two other ex-military leaders, Ibrahim Babangida and Abdulsalami Abubakar.
Jonathan, a Christian, has not said he will run, but his supporters note that he has a constitutional right to. That has upset northerners in the PDP, who think he may violate an unwritten rule that power should rotate each two terms between the largely Christian south and mostly Muslim north.
The PDP has suffered defections to an increasingly powerful opposition. Announcing Tukur's resignation to a party committee on Thursday, Jonathan suggested he had agreed to step aside to calm some party divisions. Tukur's removal had been a main demand of Jonathan's opponents within the PDP and may help to placate some.
Jonathan ordered a state of emergency and an intensified military surge last May in the northeast, where most Boko Haram attacks take place. He was forced to extend emergency rule in November as troops struggled to contain the insurgents.
Reshuffles in state institutions have been expected by analysts before the elections in a country where political patronage plays a major role.
"I suspect it's just to assert himself as commander in chief. He's facing a lot of tension at the moment. It's to remind people that 'I'm the boss'," said Lagos-based blogger and political commentator Tolu Ogunlesi.
Nigeria has been ruled by the military for long periods since independence in 1960 but Ogunlesi dismissed any suggestion that democracy was under threat. "The possibility of a coup happening is non-existent ... but it's what you do to assert your authority under pressure," he said.
A senior officer said he had expected a change but "nothing this drastic", although he was not hugely surprised. "He (Jonathan) thinks that ... the war against terrorism needs fresh ideas," he said.
All the four newly appointed chiefs of staff are experienced military officials in their mid-50s.
Air Marshal Alex Badeh - who is from Adamawa state, one of three in the northeast under emergency rule - takes over from Admiral Ola Sa'ad Ibrahim as Chief of Defence staff, the presidency said in a statement.
Nigeria, an OPEC-member, is also blighted by offshore piracy and rampant oil theft in the Niger Delta, where criminal gangs tapping into pipelines can cut out hundreds of thousands of barrels per day of output and cause environmental damage.
Financial markets took Jonathan's move in their stride. Nigeria's 2023 dollar bond was trading at 103.62 to give a yield of 5.87 percent, little changed on the day. Stocks were up 0.3 percent.
"He's changed the high command before and the market doesn't tend to react ... No one's expecting any upheaval," Standard Bank's Samir Gadio said. "A bigger concern for market players is who will be the next central bank governor?" Current governor Lamido Sanusi is due to step down in June.
Among the other appointments, Major-General Kenneth Tobiah Jacob Minimah has replaced Lieutenant-General Azubike Ihejirika as Chief of Army Staff. Rear Admiral Usman O. Jibrin is the new Chief of Naval Staff and Air Vice Marshal Adesola Nunayon Amosu has become the Chief of Airforce, a position previously held by newly promoted Badeh, the presidency said.
Our Standards: The Thomson Reuters Trust Principles.