* Military struggling to stem Islamist insurgency in north
* President facing political crisis, mass defections
* Nigeria to hold hotly contested elections next year
* No possibility of coup - analyst (Adds quotes, details, background, releads)
By Joe Brock and Tim Cocks
ABUJA, Jan 16 (Reuters) - Nigerian President Goodluck Jonathan replaced his entire military leadership without explanation on Thursday as he struggles with an Islamist insurgency and political crisis within his ruling party.
The presidency announced the removal of the chiefs of defence, army, navy and air force and named their successors. It gave no reason but the military has suffered a series of setbacks recently in fighting the Boko Haram sect which is trying to create an Islamic state in northern Nigeria.
Boko Haram gunmen stormed the air force base and military barracks around the airport of the northeastern city of Maiduguri on Dec. 2. 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-long insurgency which has killed thousands in the religiously mixed country of 170 million and is the biggest security threat in Africa's top oil exporter and second largest economy.
The Nigerian army had its own internal shake-up of senior and mid-level positions in December.
Jonathan ordered a state of emergency and an intensified military surge last May in the northeast, where the bulk of Boko Haram attacks take place. He was forced to extend emergency rule in November as troops struggled to contain the insurgents.
A presidency source said Jonathan was keen to score some visible successes against the insurgents before what are expected to be closely contested elections next year.
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.
The president is also facing a political crisis in his People's Democratic Party (PDP) and mass defections to an increasingly powerful opposition.
The PDP meets on Thursday to decide the future of its chairman Bamanga Tukur, a presidential ally who has been under pressure to quit from the Jonathan's opponents.
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.
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.
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. (Additional reporting by Felix Onuah; Writing by Joe Brock; Editing by Alison Williams and David Stamp)