The maritime spice trade monopoly in the Indian Ocean stayed with Arabs during the High and Late Middle Ages. However, the dominance of Middle East traders was challenged in the European Age of Discovery during which the spice trade, particularly in black pepper, became an influential activity for European traders. Around the 15th century, the Portuguese began to dominate the eastern shipping, and the spice-trade in particular, culminating in Vasco Da Gama‘s arrival in Kappad Kozhikode in 1498. The Zamorin of Kozhikode permitted the new visitors to trade with his subjects such that Portuguese trade in Kozhikode prospered with the establishment of afactory and a fort. However, Portuguese attacks on Arab properties in his jurisdiction provoked the Zamorin and led to conflicts between them. The Portuguese took advantage of the rivalry between the Zamorin and King of Kochi and allied with Kochi. When Francisco de Almeida was appointed as Viceroy of Portuguese India in 1505, his headquarters was established at Fort Kochi (Fort Emmanuel) rather than in Kozhikode. During his reign, the Portuguese managed to dominate relations with Kochi and established a few fortresses in Malabar coast. However, the Portuguese suffered setbacks from the attacks of Zamorin forces; especially from naval attacks under the leadership of admirals of Kozhikode known as Kunjali Marakkars, which compelled them to seek a treaty. In 1571, Portuguese were defeated by the Zamorin forces in thebattle at Chaliyam fort.
The Portuguese were ousted by the Dutch East India Company, who during the conflicts between Kozhikode and Kochi, gained control of the trade. The Dutch in turn were weakened by constant battles with Marthanda Varma of the Travancore Royal Family, and were defeated at the Battle of Colachel in 1741. An agreement, known as “Treaty of Mavelikkara”, was signed by the Dutch and Travancore in 1753, according to which the Dutch were compelled to detach from all political involvement in the region.Marthanda Varma annexed many northern kingdoms through military conquests, resulting in the rise of Travancore to a position of preeminence in Kerala.
In 1766, Hyder Ali, the ruler of Mysore invaded northern Kerala. His son and successor, Tipu Sultan, launched campaigns against the expanding British East India Company, resulting in two of the four Anglo-Mysore Wars. Tipu ultimately ceded Malabar District and South Kanara to the Company in the 1790s; both were annexed to the Madras Presidency of British India in 1792. The Company forged tributary alliances with Kochi in 1791 and Travancore in 1795. By the end of 18th century, the whole of Kerala fell under the control of the British, either administered directly or under suzerainty. There were major revolts in Kerala during the independence movement in the 20th century; most notable among them is the 1921 Malabar Rebellion and the many social struggles in Travancore. In the Malabar Rebellion, Mappila Muslims of Malabar rioted against Hindu zamindars and the British Raj. Some social struggles against caste inequalities also erupted in the early decades of 20th century, leading to the 1936 Temple Entry Proclamation that opened Hindu temples in Travancore to all castes.