So the lowborn and not too talented Ali became the "legal heir" of Ahmad II and the uncontested and unquestionable ruler of the Corsairs - once again history proved that all you need to become a ruler is good pedigree and strong allies. Ali had both - and above all, he had ambition. Ambition that no other Malik of the Corsairs had before...
Upon returning from the siege of Kaffa he immediately ordered the preparations for a full-scale war on Venice, the fading power of the Eastern Mediterranean. It was clear that with the Venetians out of the picture there would be no one in the basin of the Mediterranean (west of Madrid of course...) who could be compared to the strength of the Corsair fleet.
And though he wasn't much of a strategist or a born ruler, Ali was a captain of the fleet in the first place - and he knew that the fleet is the one that tightens the grip of the Corsairs on the throats of the Infidels through Italy...
...so he just couldn't give in to the demands of the city elders who were petitioned him for a stronger and more regular standing army. Ali believed in the superiority of attack over defence and thus he didn't share the worries of the elders about the lack of defensive capabilities.
Quick attack and the element of surprise leads to victory - that was the military doctrine of the Corsairs for centuries. And it was beyond question that it will help once again: gaining the upper hand in the inevitable war to finally crush the Venetians and all their minions and ultimately lock them up in their home city under the guard of the Pope and Aquileia. Both were more that eager to see the Doge defeated and powerless.
The initial resources in the war were quite balanced: the Kingdom of Sicily and the Duchy of Tirol (along with henchmen like the islands of Corsica, Sardinia and Malta) engaged Tripoli and her allies against the Venetians. The size of navies would tip this balance towards the favour of the Corsairs but the concentration of the fleets was low on both sides and it wasn't easy to coordinate them successfully in this quite large conflict.
Meanwhile the land forces of Tripoli were sieging the Venetian fortresses in Greece.
Athens fell in months and with the help of Tripoli's blockading allies the other ones would fall soon too. The ships of the allies were patrolling the coasts while the main fleet of Tripoli was fighting any possible concentration of enemy ships.
However the situation on Sicily wasn't so obvious...
The Sicilians put up quite a fight and they managed to beat the other contingent of Tripoli aided by troops sent by the Pope - the Sicilians were led by their king Martino himself. He was a very good general compared to the ("land-wise") inexperienced officers of Tripoli or the coward mercenaries of the Pope.
The Sicilians withstood multiple attacks and in a great battle near Messina Martino managed to even rout the entire invading troops of Tripoli before the forces of Naples could help the Corsairs out in their struggle against the better quality weapons and disadvantageous terrain.
Yet, regardless of the situation in Sicily, the naval dominance of Venice over the Eastern half of the Mediterranean was clearly over...
However with the fleeing and unorganized army in Sicily the strength of the land forces of the Corsairs became quite weak compared to other Muslim countries.
So Ali ordered the very first of his long-term army reforms that would hopefully lead to Corsair forces struggle with Infidel armies on equal terms.
Meanwhile allied Algerian forces captured the capital of the Island of Corsica and thus their duke was forced to capitulate - though he remained the direct ruler of his people, in foreign policies he became a subject to Ali's will.
In the summer of 1530, not a year into the war, the situation finally turned into Ali's favour - in all possible way. First, the repeated attacks launched from Naples and the Sea both finally broke the Sicilian resistance in Messina, their fort fell and in a final battle just outside their capital the army of King Martino was annihilated.
Second, back home a son was born to Ali so now he had hopes of passing his title directly to him. And it was only the beginning...
The capital of the Sicilians fell in early 1531 and along with it the dreams of King Martino about a strong and independent Sicily - apart from severing ties to other Christian kings, he had to hand over the City of Messina to the Duke of Naples and renounce his claim on the lands of Calabria.
Seeing the turning of the tides the Knights of St. John and the Lord of Sardinia fled the war - all that left was the Tirolian army and Venice itself. However with the full blockade on their capital, they former were effectively cut off in the foreign lands of Aquileia.
With all their Greek holdings captured, their fleet defeated and no hope of recover the Venetians had to sign peace - first of all they paid a large sum of gold in tribute and accepted Corsair merchants into their city once again, then they withdrew their claims on foreign lands all across their borders and finally their granted independence to some of their Greek subjects in Janina - who eventually became allies of the Corsairs.
So the war was over in a little more than two years - and it seemed that the figures in any future conflict between Tripoli and Castille were finally set to their places as there was little to no room for both of them to further increase their influence without violating the sphere of the other. It seemed that way...
However the plans of attacking the Crusaders had to be delayed due to a grave illness that took over Ali - it is not known if it was caused by the war or else but even the best doctors coming from Constantinople and Alexandria couldn't find a cure for it.
The illness slowly consumed Ali and he felt that he would not live long enough to see his son grow up - yet he wanted to ensure his succession so ha gathered his most trusted councilors (not one of them being a "former Councilor" too...) and he took their oath: upon his death they will tutor his only son properly and eventually raise him as a future Sultan of Tripoli!
Ali persuaded his generals that only that way could the Corsairs ensure that they will have the resources and allies needed to be victorious over the Crusaders.
Even though he felt his death slowly crawling up behind him Ali wanted to enforce all the reforms he could to help his people in the future. One of his most important decisions was the implementation of a new, central jurisdiction all over the Free Cities.
It would help keeping the order in the turmoilous years that will no doubt come after his death...
The other, even more serious decision he ordered was the introduction of cannons for the land forces.
Cannons were fairly common in the armies of the Infidels now and though the Corsairs used them too on their ships as well as in sieges this was the first time they tried to make them useful on the battlefields - but even with this important step the technological superiority of the Crusaders seemed to be impossible to keep up with...
But Ali didn't gave up - even his fading strength couldn't stop him in his work of modernizing the Corsairs as much as possible and train them for future wars against the Infidels. His reforms were quite widespread from the branches of the government system to the firearms of the navy.
And when - after a long and grave illness - he finally died in the summer 1536...
...his generals honored his wish and did not betray him: they raised the young Ali (the Second) to the throne of Tripoli and proclaimed him Sultan of the Free Cities!