Portuguese presence in the island lasted from 1505 to 1658. Their arrival was largely accidental, and the Portuguese sought control of commerce, rather than territory. The Portuguese were later drawn into the internal politics of the island with the political upheaval of the Wijayaba Kollaya, and used these internal divisions to their advantage during the Sinhalese–Portuguese War, first in an attempt to control the production of valuable cinnamon and later of the entire island. Direct Portuguese rule did not begin until after the death of Dharmapala of Kotte, who died without an heir, and had bequeathed the Kingdom of Kotte to the Portuguese monarch in 1580. That allowed the Portuguese sufficient claim to the Kingdom of Kotte upon Dharmapala's death in 1597. Portuguese rule began with much resistance by the local population.