Poisonous rivalries among Nigeria's top military brass hindered a fight against Islamic militants, forcing President Goodluck Jonathan to fire the army, navy and air force chiefs two weeks ago, he said.
The January 16 sackings, along with that of the country's most senior military officer, had up to now gone unexplained but were interpreted as a sign the chiefs had fallen short in their mission to quash the Islamic group Boko Haram.
Jonathan, during a visit to the northeastern state of Adamawa on Tuesday, said: "We will not tolerate any unnecessary competition that will bring retrogression to this country."
He referred specifically to "mutual and individual competition among service chiefs and security personnel".
The military, he said, should work together to eliminate what he called the "cancer" affecting the country.
The new chief of defence staff appointed, Air Marshall Alex Badeh, has vowed to halt the bloody violence by Boko Haram by the end of April.
Last weekend, two separate attacks in Badeh's home state of Adamawa and neighbouring Borno, which were blamed on Boko Haram, claimed at least 78 lives.
Jonathan also said a Boko Haram attack on a military base in the Borno state capital Maiduguri in early December happened because of "some obvious lapses".
Maiduguri was attacked again on January 14, when a car bomb ripped through a crowded market, killing 19.
The president said greater co-operation and effort was required to crush the insurgents.