In 1795, the French revolutionary army invaded the Dutch Republic and turned the nation into a satellite of France, named the Batavian Republic. Britain, which was at war with France, soon moved to occupy Dutch colonies in Asia, South Africa and the Caribbean. Under the terms of the Treaty of Amiens signed by Britain and France in 1802, the Cape Colony and the islands of the Dutch West Indies that the British had seized were returned to the Republic. Ceylon was not returned to the Dutch and was made a British Crown Colony. After the outbreak of hostilities between Britain and France again in 1803, the British retook the Cape Colony. The British also invaded and captured the island of Java in 1811. In 1806, Napoleon dissolved the Batavian Republic and established a monarchy with his brother, Louis Bonaparte, on the throne as King of the Netherlands. Louis was removed from power by Napoleon in 1810, and the country was ruled directly from France until its liberation in 1813. The following year, the independent Netherlands signed the Anglo-Dutch Treaty of 1814 with Britain. All the colonies Britain had seized were returned to the Netherlands, with the exception of the Cape Colony, Guyana and Sri Lanka.. How many years did the French control the Batavian Republic before being liberated?