Formerly an independent kingdom , Madagascar became a French colony in 1896 but regained independence in 1960 .