The mayor of Villanueva de Algaidas near Malaga in southern Spain had raised the rainbow flag at the village’s town hall ahead of Pride celebrations this weekend.
But police told him to bring it down, citing a Supreme Court ruling that only flags of Spain, its regions or the European Union can be flown from state buildings.
Juan Civico, the village’s Socialist mayor, told Reuters: “After the complaints, we studied what we had to do. We saw that under the law we had to remove the flag.
“But the people can put what they like on their balconies.”
A shopkeeper 50 miles away in the seaside resort of Torremolinos heard about the ban and decided to take action.
Juan Alcantara posted on a Facebook group asking villagers if they wanted rainbow flags. After getting 100 requests, he drove over to the village, where he gave out 300.
He said “The village is full [of flags]. It is incredible.”
Piedad Queralta, a villager who hung two flags from her house, said: “I think people should be free to love who they want to as long as it does not cause anybody any harm.”
Spain was the third country to legalise same-sex marriage, after the Netherlands and Belgium, changing the law in 2005.