Daoíz volunteered to help defend Ceuta against the Moors in 1790 and was given command of an artillery battery. He remained in North Africa to assist with the defence of Oran in 1791, spending part of the time with a unit of miners. Daoíz was commended by his superiors, including artillery Brigadier Andres Aznar, for his courage and zeal in the battles and was promoted to lieutenant on 28 February 1792. After Spain joined the First Coalition against Revolutionary France, Daoíz participated in the War of Roussillon, in the Pyrenees, from March 1794 but was captured in a French counterattack on 25 November 1794. He was held as a prisoner of war at Toulouse where he turned down an offer of freedom and a commission in the French Army, which was short of artillery officers. After the Peace of Basel ended the war between France and Spain on 22 July 1795, Daoíz was released and made his way back to El Puerto de Santa Maria.