It seems that it stood more or less on its own until the mid-seventeenth century, with no other major construction on the summit, and the only addition was a hut next to the tower that sheltered the sentinel during storms. This was later enlarged to become a guardhouse.
With the onset of the Revolt of Catalonia (1640-1652) the Consell de Cent municipal government decided to fortify the summit of Montjuïc by surrounding the lookout tower with a wall, giving it importance as a defensive stronghold and marking the beginning of the militarization of the hill. Faced by the threat of a naval siege of the city by the Spanish fleet of Philip IV, in 1640 the population was mobilized in face of the need to defend the capital and proceeded to build, in just thirty days, a small quadrangular fortification with four demi-bastions at the corners. These were equipped with embrasures and in this way any sector of the walls could be covered by crossfire, with space for a few musketeers and twelve artillery pieces. The fort was guarded by one the city’s tercios, a military unit made up of the guilds (shoemakers, tailors, etc.), French soldiers, and some irregular troops known as miquelets, The troops of Philip IV were forced to retreat after attempting to capture the summit in the so-called Battle of Montjuïc, which took place on 26 January 1641.
Later, in 1643, the Consell de Cent and the War Council undertook the renovation of the fort in view of its new strategic importance. It was decided that the tower should be the same height as the bastions and various modifications were made to the parapets. In addition, a gunpowder and ammunition magazine was built on the staircase landing in the tower. Chains and metal protections were fitted to the entrance doors and a drawbridge was built. Then, with the capture of Barcelona by Philip IV in 1652, the castle became the property of the Spanish monarchy and a permanent garrison was billeted there. At the end of the seventeenth century, a series of maritime attacks and sieges took place during the Nine Years’ War (1688-1697), which led to further improvements to the castle, planned by the military engineer Lorenzo Tossi. Finally, a new citadel was built, with the old ward inside and featuring three defensive bastions and a rectilinear façade facing towards the sea.