An ousted branch of a Genoese family, the Grimaldi, contested it for a hundred years before actually gaining control. Though the Republic of Genoa would last until the 19th century, they allowed the Grimaldi family to keep Monaco, and, likewise, both France and Spain left it alone for hundreds of years. France did not annex it until the French Revolution, but after the defeat of Napoleon it was put under the care of the Kingdom of Sardinia.