This fortress was used as a protective wall of palace from enemy attack. In Ngayogyakarta Sultanate, it is named Benteng Baluwerti (Baluwerti fortress), the walls which encircle the central region of Yogyakarta Palace. Baluwerti fortress is built during the reign of Sultan Hamengkubuwono I, in 1785-1787. It was initiated from the Crown Prince, Raden Mas Sundoro (1750-1828) who was crowned as Sultan Hamengkubuwono II. It was strengthened on the reign of Sultan Hamengkubuwono II, precisely in 1809.
As a defense wall, it was equipped with a cannon prepared to fire at anytime, placed on the walls of fortress. Moreover, as can be found it was rectangular fortress. Each side has a length of approximately 1000 meters, height of 3-4 meters, and 4 meters of thick, allowing soldiers to patrol on top of fortress. It was surrounded by canal to strengthen the defense with a width approximately 4 meters and 3 meters of depth. However, at present time, the original canal cannot be found anymore.
Inside the fortress, especially those in the south, was well equipped with a small road for the mobilization of soldiers and weaponry. While in the four corners of fortress was built bastion that equipped with a small hole that used for spying the situation outside the castle. Bastion was then known as Pojok Beteng. Now, the only remaining is just three Pojok Beteng (bastions).
In addition, there are five gate-shaped as tunnels to enter the fortress that was always guarded by soldiers of Kingdom. The five gates are called plengkung, because they have curved shapes. Plengkung was made from thick and strong wood. Those fifth Plengkung namely Plengkung Tarunasura (Wijilan) in the northeast of palace, Plengkung Jagasura (Ngasem) in the southwest, Plengkung Jayabaya (Tamansari) in the west, Plengkung Nirbaya (Gading) in the south, and Plengkung Tambakbaya (Gondomanan) in the east. Of the fifth Plengkung, they are only two remaining, namely Plengkung Tarunasura in Wijilan and Plengkung Nirbayain in gading.