Desmond Castle "was built as the Customs House for Kinsale about the year 1500 by Maurice FitzGerald, 9th Earl of Desmond, following the grant of the customs of the port of Kinsale to the Earls of Desmond by King Henry VII in 1497. Presumably there must have been an earlier structure on the site as the 1st Earl was Captain of Desmond Castle.
It was used as a Customs House until 1641 when it was converted into a naval prison, following the construction of a new Customs House. The prisoners kept in the Castle were in the main French and Spanish, and the building became known locally as the 'French Prison' as a result.
In January 1747, a fire broke out, killing 54 of the prisoners. In 1791, the castle was donated by James Kearney MP to the town of Kinsale, and it was subsequently used as a town gaol till 1846, and during the Irish Famine as a workhouse. In 1938, it was taken into government hands, and in the 1990s was restored and opened to the public by the Office of Public Works" (Wikipedia).