The rise of centralized kingdoms among the Sakalava, Merina and other ethnic groups produced the island's first standing armies by the 16th century, initially equipped with spears but later with muskets, cannons and other firearms. By the early 19th century, the Merina sovereigns of the Kingdom of Madagascar had brought much of the island under their control by mobilizing an army of trained and armed soldiers numbering as high as 30,000. French attacks on coastal towns in the later part of the century prompted then-Prime Minister Rainilaiarivony to solicit British assistance to provide training to the Merina monarchy's army. Despite the training and leadership provided by British military advisers, the Malagasy army was unable to withstand French weaponry and was forced to surrender following an attack on the royal palace at Antananarivo. Madagascar was declared a colony of France in 1897.