In Northern Italy, between 1796 and 1814, Napoleon Bonaparte formed a Republic, and then a Kingdom, controlled by France. Milan was the capital of the State, and the Brera Palace was the main cultural centre, as regards both the arts and the sciences. Bonaparte probably intended to strengthen this characteristic of Brera, aiming at increasing its Italian and European relevance. We will discuss in detail in which way he interacted with the astronomers of Brera Observatory, and in particular with Barnaba Oriani, that was considered the local main representative of the 'republique des lettres', that is, the world of literature, arts and sciences. We propose a possible reconstruction of the effects of those complicated historical events on the Italian astronomy and on its relations with the European one.