The popular insurgent movements that emerged during this period were liquidated by the government of Espartero. On 3 December 1842 he ordered the bombardment of the city from the Castle during twelve hours, as punishment for the spontaneous protests. The cannons fired 1014 projectiles and caused at least twenty deaths and widespread destruction throughout the city. By the time the offensive had ceased, to quote an eye witness “the city had taken on a sepulchral aspect: doors and shops closed, the streets almost deserted, in some places obstructed by the ruins and rubble of devastated houses and shrouded by the smoke coming from the many still burning buildings.” The following year, on 2 September 1843, the instatement of the Supreme Provincial Junta provoked a revolt known as la Jamància, demanding a fairer distribution of wealth. On 10 November, Barcelona was again systematically bombarded from Montjuïc, on this occasion for two months, causing 335 deaths, 354 injuries and significant material damage, to the extent that around 40,000 people fled the city. Yet again, in July 1856, the city was shelled from Montjuïc, in conjunction with forces stationed in the Ciutadella and Drassanes, this time by order of the Captain General Juan Zapatero, as a consequence of the protests against the military coup that had toppled the progressive government. The city was occupied by the army and the subsequent repression resulted in over 400 casualties.
In the last quarter of the 19th century, Montjuïc was used as a prison for anarchists, trade unionists and revolutionaries, including those responsible for several attacks and terrorist acts in Barcelona, and it was also where they were court martialled and executed. In 1896, around seven hundred people were arrested following an anarchist attack in the street of Carrer dels Canvis Nous during the Corpus Christi procession, which caused twelve deaths. The police, instead of investigating the facts according to the rule book, carried out mass arrests: on the one hand acting with impunity against the ideological adversaries of the regime, with the intention of destroying the anarchist movement and intimidating the republicans, and on the other hand, with the aim of identifying the perpetrators of the attack. Most of the detainees were imprisoned, tortured and tried in the Castle. Finally, four of the them were sentenced to death and executed by firing squad in the moat, while another sixty-seven were sentenced to prison terms of between eight and twenty years. These events, known as the Process of Montjuïc, were denounced internationally, and in the end the central government gave in under the pressure and freed the prisoners in 1901.
The castle maintained its repressive role during the events of the Tragic Week, the general strike called in 1909 against the government’s call-up of reserve troops to send to the colonial war in Morocco. The strike turned into a revolt, with acts of vandalism, the burning of churches and the desecration of tombs, resulting in more than a hundred deaths and the arrest of about two thousand people. Five of the accused were shot in the moats, including the libertarian educator and founder of the Modern School, Francesc Ferrer i Guàrdia. Later, in 1919, following another general strike that lasted one and a half months, called to protest against the dismissal of eight workers from the power station owned by La Canadenca, about three thousand workers were imprisoned in the castle after refusing army call-up, by order of the Captain General Milans del Bosch.