His grandfather John Reyly was a colonel in the Jacobite Irish Army of James II, whose regiment—O’Reilly's Dragoons—fought at the siege of Derry.
He recommended sweeping reforms to improve the fortifications, training, practices, and troop organization, which were quickly approved by the Spanish Crown.
Under the direction of Silvestre Abarca, a Royal Army military engineer, construction of the strategic La Cabaña fortress began according to O'Reilly's recommendations.
O'Reilly, known today as the "father of the Puerto Rican militia," took a complete census of the island and recommended numerous reforms, including instilling strict military discipline among the local troops.
He insisted that the men serving the defense of the realm receive their pay regularly and directly, rather than indirectly from their commanding officers, a long-standing practice that had led to abuses.
Having crushed the ringleaders who had led the Louisiana Rebellion of 1768 (the uprising against Ulloa and Spanish rule), O'Reilly sent most of his troops back to Cuba.
[10] He regularized the weights and measurements used in marketplaces, regulated doctors and surgeons, and improved public safety by funding bridge and levee maintenance.
Although this North African campaign was a disaster, the high reputation of O'Reilly was not destroyed, and he continued to serve as captain-general in southern Spain.
He died in the city of Cádiz in 1794, aged 72, while on his way to take command of an army in the Eastern Pyrenees that had been ordered to oppose invading French revolutionary forces, just after the beheading of Louis XVI.