At the start of 1767, the Mysore army unsuccessfully stormed the Kingdom of Travancore  from the north. In 1767, the whole of Malabar again revolted Mysore's army of 4,000 men, who were defeated by 2,000 Kottayam Nairs in Northern Malabar. All baggage, arms and ammunition of army was looted by the Nair rebels. Mysorean garrisons were trapped by Nair rebels who seized the countryside and ambushed Mysore convoys and communications with great success. The following year, the English East India Company, under Captain Thomas Henry, sieged the Sultan Bathery Fort  to interrupt the supply of arms to Arakkal Kingdom, with a promised help from local kingdoms. But the British were forced to retreat in the retaliation. Mysore army retreated from Malabar temporarily in 1768, successfully crushing the uprisings and building the strategic Palakkad Fort. The authority over Kolathunad was now given to the Arakkal Kingdom. Skirmishes between Arakkal and the Company continued, and in 1770, the Company reclaimed Randattara. In 1773, Mysore forces under Said Saheb and Srinivasarao marched to Malabar through the Thamarassery Pass, since the Hindu rulers had broke the earlier treaties on paying tributes. So, again in the Malabar came under the direct Mysore authority.
Question: Which happened to the Mysore army first, building Palakkad Fort or being defeated by the Nair rebels?
Answer: defeated by 2,000 Kottayam Nairs