In 1503 the independence of the Republic was threatened by Cesare Borgia, called “Valentino” (1475-1507), Prince of Romagna and son of Rodrigo Borgia (Pope Alexander VI), who managed to occupy the territory for 6 months and to transfer the capital to Serravalle; however, in the end, opposed by the new Pope Giulio II, Valentino was forced to abandon the ambitious venture.
The beginning of the XVII century represents an important part of the history of San Marino; in fact, the Duchy of Urbino, at the beginning of 1600, seems to be reaching the end of its ancestral line since the Duke Francesco Maria della Rovere had no heirs. It, therefore, became evident that the Duchy would be inherited by the Church of Rome, thus upsetting the complicated network of political alliances which during earlier centuries furnished San Marino with the support and protection it required. For this reason, in 1603, anticipating the events, a Treaty for Protection was signed with Pope Clemente VIII. This Treaty was then confirmed by Pope Urbano VIII in 1629 and entered into force definitely in 1631 at the death of Duke Francesco Maria with the consequent passing of the Duchy of Urbano to the Holy See. Once again San Marino successfully managed the delicate situation which had come about and, at the same time, maintained its valuable independence.
A new political crisis inherent to its autonomy hit the small Republic in the 1700’s. In 1739, Cardinal Giulio Alberoni, Papal Ambassador to Romagna, penetrated into the San Marino territory with his army, with a deceiving pretest: to search for two outlaws (Pietro Lolli, ex Councilor and Regent and Marino Belzoppi). The Cardinal brought about variations to the laws of San Marino and forced the Authorities to swear loyalty to the Papal State. On February 5, 1740, the entire affair was resolved thanks to the intervention of the Papal delegate Enrico Enriquez (sent by the Holy See in reply to San Marino’s request for help). Thus, again, the small state of San Marino succeeded in winning back its independence. Today, this date is celebrated as the Feast of Saint Agatha (Co-patron saint of the Republic).
From the French Revolution (1789) on, a series of events upset the political order in Europe. Once again San Marino faces the problem of defending its independence; this time from the aggressive French political intentions. It becomes ever more imminent when Napoleon completes his conquest of Northern Italy and begins to push his armies towards the edges of the northern territories of the Papal State.
The Government of San Marino finds itself forced to choose between maintaining the alliance with the Papal State or creating a new alliance with France.
An error of evaluation could mean the loss of its valued liberty and for this reason, an extremely prudent course of action was taken; namely, not to take sides until it became inevitable. The event that posed San Marino in the position of having to choose where to stand came about on February 5, 1797, with the arrival of a letter from General Alexandre Berthier, addressed to the Regents, intimating the arrest and consignment of the Bishop of Rimini, Monsignor Vincenzo Ferretti, accused of instigating crimes against the French and fleeing with all his possessions to San Marino. A refusal would result in the immediate intervention of French troops. The Government of San Marino replied that it would do all possible to fulfill the request, even though, in reality, the bishop was able to flee across the border.
The merit of this solution goes to the Regent, Antonio Onofri, who managed to gain the respect and friendship of Napoleon. Thanks to his intervention, Napoleon, with a letter delivered to Gasparre Monge, scientist and commissary of the French Government for Science and Art, promised to guarantee and protect the independence of the Republic offering to extend its territory according to its needs. The offer was declined by San Marino, in fear of future vindications on the territories annexed, which would seriously risk the liberty of the country – liberty which continued to constitute the most precious patrimony for San Marino citizens.
For his part, Napoleon issued orders that exempted San Marino citizens from any type of taxation and gifted them with a thousand quintals (over 2200 lbs) of wheat and four cannons (for reasons unknown, these never arrived). In all the events that followed, San Marino managed to safeguard both the relationship with Napoleon as well as that with the Papal State.