In 1796, French Republican troops under the command of Napoleon Bonaparte invaded Italy, defeated the papal troops and occupied Ancona and Loreto.

Pope Pius VI sued for peace, which was granted at Tolentino on February 19, 1797; but on December 28 of that year, in a riot blamed by papal forces on some Italian and French revolutionists, the popular brigadier-general Mathurin-Léonard Duphot, who had gone to Rome with Joseph Bonaparte as part of the French embassy, was killed and a new pretext was furnished for invasion. General Berthier marched to Rome, entered it unopposed on February 10, 1798, and, proclaiming a Roman Republic, demanded of the Pope the renunciation of his temporal power.

Upon his refusal he was taken prisoner, and on February 20 was escorted from the Vatican to Siena, and then to the Certosa near Florence. The French declaration of war against Tuscany led to his removal by way of Parma, Piacenza, Turin and Grenoble to the citadel of Valence, the chief town of Drôme where he died six weeks after his arrival, on August 29, 1799, having then reigned longer than any Pope.

Napoleon realized the importance of religion as a means to increase obedience and his control over the French. It was not until the conclave of Cardinals had gathered to elect a new Pope that Napoleon decided to bury Pope Pius VI who had died several weeks earlier. He gave him a gaudy ceremony in an effort to gain the attention of the Catholic Church.

More Info: en.wikipedia.org