The Johor Sultanate was seeking to get rid of the Portuguese to regain control over Malacca. But the admiral of Johor, Tun Abdul Jamil knew that would be difficult since the Portuguese were far more advanced than his army in terms of weaponry. The only way that was possible if Johor joined forces with the Dutch.
Johor with its European ally assaulted and wrested Malacca from the Portuguese in January 1641. This combined Dutch-Johor effort effectively destroyed the last bastion of Portuguese power, removing their influence in the Malay archipelago.
Tun Abdul Jamil was thankful to the Dutch for their help and asked if they wanted anything in return. The Dutch simply asked for a piece of land in Malacca which was as wide as a piece of dried up cow's skin. Thinking that is nothing much, the Johor admiral permitted the Dutch to take any part of Malacca that they wanted. In his mind, Jamil thought the Dutch were complete idiots for asking something like that.
But once an agreement was signed between Tun Abdul Jamil and a representative from the Dutch East India Company, the Dutch traders started cutting the piece of cow's skin and turned into a long rope. The rope was then tied from one end of the Malacca port right up to the other end of it. The great Malacca port now belonged to the Dutch.
With the port now no longer within their property, Tun Abdul Jamil felt there was no longer any need to own Malacca and thus gave the whole kingdom to the Dutch. That is how Malacca fell from one foreign power to the hands of another foreign power.