Ibrahim Agha (Algeria)

Ibrahim Agha, was an Algerian noble, commander of the Algerian forces during the Invasion of Algiers, and the son-in-law of Hussein Dey.
Early life.
He married Hussein Dey's daughter at an unknown date. Whether he was a native Algerian, a Turk, or a Kouloughli is also unknown. 
He was appointed as Agha (general) in 1828.
Sidi Fredj.
In 1830 France invaded Algeria after a naval blockade lasting for three years. Hussein appointed Ibrahim as the commander-in-chief of his forces, which consisted of contingents from the Beylik of Constantine, Titter, and Oran, and the Dar-as-Soltan Janissary militia. He advised Hussein to let the French land in Algeria, to make sure that "not one of them would return to their homeland". Upon hearing of the French navy sighted near Sidi-Fredj, he organized the army, and attempted to defend the town. The army itself was horribly prepared, as the Dey didn't make any efforts to better his army. The battle started on June 14 and the Algerians were able to inflict 32 casualties on the French after which they retreated. The Algerians hardly sustained any casualties but lost 16 artillery, and two mortar pieces.
Staouéli.
Upon retreating the next day Ibrahim showed himself in his very best clothes. His tent was magnificently decorated, and he was ready to launch an attack.
The French at the time were waiting for additional equipment to arrive, since a large amount of their older ones got destroyed in a storm, and in the battle of Sidi Fredj. He wanted to surprise the enemy using a quick raid on their camps. Ibrahim himself knew of the importance of the battle but regardless only used 10,000 of his about 40,000 troops to attack the French army since he underestimated their numbers and prowess. The Algerian attack got repulsed by the French army, whom counter-attacked and seized the Algerian artillery, camps, and the town of Staouéli itself. The Algerians, pursued with bayonets were routed shells launched with marvelous dexterity wherever large groups presented themselves, caused terror amongst them. The Algerian batteries, on the contrary, firing without accuracy, produced no effect; led by even more skillful gunners, their fire did not shake the French troops. From that moment the Algerians understood their weakness, which lied in the old weaponry, and the bad craftsmanships. They did not wait for the shock which threatened them, and instead fled precipitately towards their camp, which they crossed without even thinking of defending it.
Hussein's reaction.
When the first news of this appalling defeat was heard of in Algiers, the indignant populace came to besiege, the doors of the Casbah, demanding the deposition of the dey, his death, and his torture, and the execution of Ibrahim. At the same time, a multitude of janissaries, makhzen tribesmen, and amazigh infantry emerged through the small streets bordering the Casbah, laden with heads, weapons and uniforms of French soldiers, came to ask for the price of their trophies. Upon Ibrahim's return to Algiers he was taken into the Dey's palace, wherein this conversation went down:
"Well?!- cried Hussein, in a voice trembling with anger, from as far away as he saw his son-in-law- "what news does our 'invincible' agha bring? The French have undoubtedly returned to their ships, unless he has thrown them into the sea, as he has promised us so many times. Will the Casbah be large enough to contain their remains, and the prisons large enough to lock up all the prisoners?""
Terrified by this bloody irony, Ibrahim was silent.
"Speak! Speak!- Hussein said to him- Is it true that my son-in-law, the generalissimo of our holy militia, fled shamefully from this army of infidels?"
"What did you want me to do?- Ibrahim finally answered with an effort- Three times I rushed with rage against these cursed Christians, and always they remained steadfast. By Allah! They have to be protected by a powerful genie, or have to be hooked up to each other."
Far from being appeased by this excuse, the dey's fury, until then concentrated, broke out in terrible insults.
"Dog, slave, coward!- he cried with rage, rushing against Ibrahim, and spitting in his face- go away, get out of my palace miserable one! If you weren't my daughter's husband, I would instantly make you rush to your feet." Ibrahim, appalled, bowed respectfully and went to hide his shame at the bottom of his Moorish villa, where he was not long in receiving the notice of his grace, obtained through the intercession of his wife, all-powerful over the spirit of the dey.
Sidi-Khalef.
He launched one last desperate battle at Sidi-Khalef to save both his honor, and Algeria, but following his defeat, he was removed by Hussein.