The Sultanate of Malacca was seized by the Portuguese in 1511 but, a century later, they were driven out by the Dutch in alliance with the Sultan of Johor. The peninsula then became a Malay kingdom ruled by Johor. In 1786 the Sultan of Kedah granted the island of Penang to the British East India Company for use as a trading post; less than a decade later, the British took Malacca from the Dutch. In 1819 the British also acquired Singapore. Penang, Malacca and Singapore were ruled directly by Britain as the Straits Settlements.