Diu has a long history before the rule of Portuguese. The union territory was ruled by Mauryans, Kshatrapas, Guptas, Maitrakas, Chavda dynasty, Chalukyas, and Portuguese. The ruling periods of these dynasties are as follows −
Prior to Portuguese, Diu was under Muslim rule. In 1297, Alauddin Khilji defeated the Rajputs and made Diu his territory. After that Diu was under Muslim rule for about one and a half century.
Sultan Bahadur Shah of Gujarat annexed Diu in 1530AD. He built many structures for the security of Diu which were knocked down by Portuguese to make their structures. The Portuguese tried to annex Diu to their kingdom many times but they failed. In 1531, they captured Shiyal Bet island under Nuno da Cunha and started bombing Diu but were not able to occupy it.
In 1534, the Portuguese signed a Treaty of Bassein and through which the occupied Bassein now known as Vasai. Bahadur Shah had a threat from Mughal Emperor Humayun so he made a peace treaty with Portuguese. According to this treaty, they got permission to build a fort in Diu.
Later, Bahadur Shah had no trust on Portuguese and he attacked them but was killed in the war. His body was thrown into the sea. Mahmud Shah III, nephew of Bahadur Shah, succeeded him. Diu was under Portuguese since 1961 and after that Indian govt. forced them to leave the place through Operation Vijay.
Turks attacked Diu in 1538 and besieged the fort. The force included 20,000 men and 66 ships. They bombarded the fort many times. When they were about to win, they lifted up the siege. The reason for uplifting the siege is not known but from that time onwards, Turks never attacked India.