The Portuguese built the fort, to guard the entrance to the Jaffna peninsula, in the mid 17th century of quarried coral naming it Fortaleza do Caes (Fort Royal). The Dutch, under the command of Captains Cornelies Reb, Piester Waset and N. van der Reede, captured the fort in March 1658 and subsequently renamed it Hammenhiel (Heel of the Ham), as they considered that shape of Ceylon resembled a smoked ham and the fort was located at the point where the shank bone projects. The Dutch rebuilt the fort in 1680, constructing a stone breakwater, filling in the hollow ramparts, replacing the upper floor with a stone vault and building a brick lined reservoir to the north of the fort. The prison has nine large dungeons to store gunpowder. The Dutch maintained a garrison of about thirty soldiers under the charge of a Lieutenant or Ensign. The British used the fort firstly as a maximum security prison and then as an infectious diseases hospital.