Twelve Nigerian soldiers have been sentenced to death for mutiny and attempted murder after shots were fired at their commanding officer in the north-eastern city of Maiduguri in May.
The soldiers were angry after a convoy was ambushed on a road frequently targeted by Islamist Boko Haram militants.
Five other soldiers were acquitted and one was convicted on another count.
All denied the charges at a court martial in Abuja.
Front-line troops often complain that they lack adequate weapons and equipment while there have also been reports that they have not been paid or properly fed.
Last month, a group of soldiers in the north-east refused to fight Boko Haram until they received better equipment, one of them told the BBC.
Boko Haram fighters are well armed and determined. Having been brainwashed with extremist ideology, many are likely to have little fear of death. So the Nigerian soldiers sent to the battered north-east have a difficult fight and need to be well resourced.
But there have been numerous reports of low morale amid calls for better arms and even complaints over pay. Soldiers' wives recently demonstrated in the barracks in Maiduguri in an effort to stop their husbands being sent to the front line.
Shooting at your own commanding officer is an extreme reaction to seeing the bodies of colleagues killed in an ambush and it would lead to a severe punishment in any army. But it is just one sign of the problems undermining the fight against Boko Haram.
President Goodluck Jonathan has promised that better equipment is on the way but given that Boko Haram has been growing for several years, why were the billions of dollars earned from Nigeria's oil industry not spent on giving every soldier the best chance of defeating the enemy and staying alive?
The nine-member military tribunal heard that the incident happened when shots were fired at the commanding officer of the Nigerian Army's Seventh Division, which is at the forefront of the fight against Boko Haram.
Witnesses said the soldiers lost discipline and threw stones at the officer when he arrived at their camp, and shots were fired into the air.
General Amadu Mohammed had to take cover as they aimed their guns at him - firing bullet-holes in his armour-plated staff car - but he was not injured.
Court President Chukwuemeka Okonkwo said that while the sentences were subject to confirmation by Nigeria's military authorities, there was no doubt about the seriousness of the offence.
The sentencing panel took into account the "likely effect on counter-insurgency operations" of the incident as well as its "implications on national security".
Nigeria's army has been under pressure to end the bloody five-year insurgency - and a state of emergency was declared in three north-eastern states last year.
Boko Haram is fighting to create an Islamic state in Nigeria - and has stepped up its attacks after being pushed out of its bases in Maiduguri, the capital of Borno state, targeting towns and villages in deadly raids.
The fighting has claimed thousands of lives, made tens of thousands of people homeless and seen the militants make recent territorial gains.
Related story: Nigerian soldiers attack own army commander
Some Nigerian soldiers refuse to fight Boko Haram until given new weapons