Portugal was the first European power to arrive in Gujarat, acquiring several enclaves along the Gujarati coast, including Daman and Diu as well as Dadra and Nagar Haveli. The British East India Company established a factory in Surat in 1614, which formed their first base in India, but it was eclipsed by Bombay after the English acquired it from Portugal in 1668.
Later in 17th century, Gujarat came under control of the Maratha Empire who dominated the politics of India. Pilaji Gaekwad, first ruler of Gaekwad dynasty, established the control over Baroda and much of Gujarat. The British East India Company wrested control of much of Gujarat from the Marathas during the Second Anglo-Maratha War in 1802-1803. Many local rulers, notably the Maratha Gaekwads of Baroda (Vadodara), made a separate peace with the British and acknowledged British sovereignty in return for retaining local self-rule. Gujarat was placed under the political authority of the Bombay Presidency, with the exception of Baroda state, which had a direct relationship with the Governor-General of India. From 1818 to 1947, most of present-day Gujarat, including Kathiawar, Kutch, and northern and eastern Gujarat were divided into hundreds of princely states, but several districts in central and southern Gujarat, namely Ahmedabad, Broach (Bharuch), Kaira (Kheda), Panchmahal, and Surat, were ruled directly by British officials.