Having returned home in 1807, he declared his support for King Joseph I. He was appointed intendant of Segovia and then Cordoba. On the abdication of King José following the French defeat at Vitoria in 1813, Badia fled to France. In 1814, he published a French account of his travels in three volumes. An English translation was published in 1816. There was much mystery about Ali Bey, since the account was written from his persona. Bankes, writing in 1830, roundly asserted that he was a Jew, and many later writers have thought that he was a genuine Muslim of Moroccan origin but of Spanish education.