Built in 1640 by rebels against Felipe IV, the castle has had a dark history as a symbol of Barcelona's military domination by foreign powers, usually the Spanish army. The fortress was stormed several times, most famously in 1705 by Lord Peterborough for Archduke Carlos of Austria. In 1808, during the Peninsular War, it was seized by the French under General Dufresne. Later, during an 1842 civil disturbance, Barcelona was bombed from its heights by a Spanish artillery battery. After the 1936–39 Civil War, the castle was used as a dungeon for political prisoners. Lluís Companys, president of the Generalitat de Catalunya during the civil war, was executed by firing squad here on October 14, 1940. In 2007 the fortress was formally ceded back to Barcelona. The present uses of the space include a Interpretation Center for Peace, a Space for Historical Memory, and a Montjuïc Interpretation Center, along with cultural and educational events and activities. A popular weekend park and picnic area, the moat contains attractive gardens, with one side given over to an archery range, and the various terraces have panoramic views over the city and out to sea.