When the Spaniards Were Here (Da Spanierne var her) is a romantic, comic play by Hans Christian Andersen.
It premiered on the Royal Danish Theatre in Copenhagen on 6 April 1865, just a few days after the celebration of Andersen's 60th birthday.
Andersen's first childhood memory involved Spanish soldiers on Funen.
The male protagonist of his play Skilles og mødes was also a Spanish soldier.
In 1865, he adapted it into the play When the Spaniards Were Here, changing the setting from Odense to Middelfart.