The Portuguese constructed the first fortifications in 1595, with the assistance of Don Juan Dharmapala, the ruler of the Kingdom of Kotte. In 1640 the Dutch captured Matara from the Portuguese, and in 1645 they were responsible for the construction of the current fortifications. The fort consists of a 240 m (790 ft) long, 13 m (43 ft) thick, 5 m (16 ft) high rampart and the gateway constructed from local limestone, granite and coral. The rampart originally had a ditch in front of it, two half bastion projections at each end and a larger projection in the centre close to the gate with a bridge across the ditch. It was built to protect the administrative buildings of VOC (Dutch East India Company), who were attracted by the deep and sheltered estuary of the Nilwala Ganga, making Matara an important centre for cinnamon and elephant trading.
During the ‘Matara Rebellion’ of 1761, the fort was captured by a Kirti Sri Rajasinha’s Kandyan army that bombarded the town with cannonballs that went over the wall. After spiking their own cannon and destroying their ammunition and provisions, the garrison was evacuated by two ships that were waiting at sea. The Dutch recaptured the fort on 2 February 1762, finding eight cannon on the walls, including an English one. During the Dutch rule the District Secretary’s house, the cinnamon, areca nut, gunpowder storage and an elephant kraal (containing four elephant stables, which could house up to 80 elephants and a tank where the elephants were washed) were constructed within the fort.
The oldest building within the fort is the Dutch Reformatory Church, which is situated near the entrance. It was built by the Dutch in 1706 the date however etched above the entrance, 1767, refers to the reconstruction of the church by the Dutch following the Matara Rebellion. The door and window panels are made of heavy wood while the walls now show signs of crumbling as the proper mixture to rebuild them could not be found within Sri Lanka. Inside are gravestones on the floor dating back to 1686, of significant community members and beneficiaries of their time. On 24 February 1796 the Fort was handed over to the British by the Dutch. The southern bastion facing the sea was subsequently removed by the British, in order to grant access to the town along the ocean foreshore.
During the British occupation, the Courts Complex (including the Magistrate Court and the High Court), Rest House and the Matara Police Station were constructed within the fort area. The majority of walawwas or mansions that belonged to Sri Lankan aristocratic families within the fort area are now utilised for other purposes, such as commercial offices, guesthouses and temples, while others have been let to fall into ruin. In 1883 the British built a 12 m (39 ft) high clock tower atop the remaining rampart. The rampart was declared a protected monument under the Antiquities Ordinance No 9 of 1940 section 33. The gate and walls of the main fort were restored in 1985-86 by a Dutch firm, Ballast Nedam. Matara fort is currently the administration centre for the entire Matara District, with the offices of the District Secretariat, Divisional Secretariat, Courts of Law and numerous other state offices.