When his father died in 1792, O'Neylle was an infantry battalion commander of the 3rd Regimento de la Princesa. His first actions were in Roussillon and Catalonia in May 1808 where he distinguished himself and was put on the staff of José Rebolledo de Palafox y Melzi. O'Neylle marched with his troops from Valencia to Aragon where he was instrumental in lifting the French siege and driving away the forces of François Joseph Lefebvre who was forced to retire to Navarre. Palafox entrusted O'Neylle together with the Marqués de Lazán to press the retreat of Lefebvre. This bold attack forced the occupying French forces to abandon Tudela and O'Neylle was personally responsible for destroying a French column in the area around Nardués. On November 23, 1808, the Spanish army of Andalucía regrouped and prepared to give battle under the command of Francisco Javier Castaños, 1st Duke of Bailén with Palafox as the second in command. This engagement was to become known as the disastrous Battle of Tudela. The French forces, under the command of Jean Lannes routed the Spanish army which was forced to retreat to Zaragoza.