The advance of Napoleon's army in 1797 presented a brief threat to the independence of San Marino, but the country was saved from losing its liberty by one of its regents, Antonio Onofri, who managed to gain the respect and friendship of Napoleon. Due to Onofri's intervention, Napoleon, in a letter delivered to Gaspard Monge, scientist and commissary of the French Government for Science and Art, promised to guarantee and protect the independence of the Republic, even offering to extend its territory according to its needs. The offer was declined by the regents, fearing future retaliation from other states' revanchism.