The early history of Kerala is very complicated and there are many problems remaining to be resolved by historians. The region was united between approximately A . D . 216 and 825, when the Malayalam era is said to have begun. By the Beginning of the ninth century A . D . the area was divided into a number of small kingdoms, each ruled by a Nayar or Kshatriya (higher matrilineal subcastes related to Nayars) royal family. Those families were relatively autonomous, owing little allegiance to any overlord. Between the thirteenth century and 1498 (when the Portuguese arrived in Kerala) two Nayar chiefdoms, Kolattiri in the north and Travancore in the south, expanded into small kingdoms. In the central part of the coast the Zamorin of Calicut was in the process of establishing ascendancy over many of the petty rulers and was slowly expanding his territory through an alliance with the local Muslims and Arab traders. Although the Portuguese and later the Dutch and the British built up the ruler of Cochin (another central Kerala coastal kingdom), the Zamorin's kingdom remained powerful until the invasions of the Mysoreans in the eighteenth century. After defeating the Mysoreans in 1792, the British amalgamated the seven northern kingdoms (including the reduced domain of the Zamorin) to form the Malabar District of the Madras Presidency. The kingdoms of Cochin and Travancore remained independent, though each had a British resident and many British businesses. When India became independent in 1947, Malabar District became part of Madras Province and Travancore-Cochin became a separate state; in 1956 the state of Kerala was formed, uniting the district of Malabar with the state of Travancore-Cochin.