In June 1713, after the treaty that ended the war with Castile, the Junta de Braços, the highest body convened by the Generalitat and equivalent to a legislative chamber, proclaimed armed resistance against the Bourbons despite the withdrawal of Allied troops and betrayal by Great Britain. The defence of the city was left in the hands of a non-professional force composed of craftsmen and artists, the Coronela, of which Rafael Casanova was the leading commander.

Catalonia had no army, so common people were the ones involved in the defence of Barcelona. This was a consequence of the political model of the city, by which popular sectors also participated in the governing bodies of the Consell de Cent through guilds and craft organisations. The residents issued a call to take up arms to defend their rights. Therefore, admission to the Coronela was seen as a civic duty, inherent in residents' exercise of their political rights. Abandonment by the royal authorities and allied armies meant that the city's resistance fell exclusively upon Catalan institutions, which resorted to mobilising the population, calling for people to defend their Catalan rights and laws.

The final stage of the conflict centred on the siege of Barcelona between July 1713 and September 1714, which captured the attention of the entire continent. The city was defended by the companies created by the guilds under the orders of Antonio Villarroel and Rafael Casanova.

The final assault on the city occurred on 11 September, when Philip V's troops attacked the points where the wall was more damaged, between the bastions of Portal Nou, Santa Clara and Llevant. Casanova led the counter-attack and was wounded. Villarroel counter-attacked in Plaça del Born, but was seriously wounded. In the afternoon, Barcelona surrendered.