In Barcelona (and I think all of Spain), your 1-month deposit is kept by the state and is automatically returned to you unless the landlord can prove that you did something that entitles them to it.
Its the same in the UK. But many landlords aren't compliant with this, and enforcement varies
The landlord is supposedly legally enforced to put the money in the chamber of commerce, but ALAS not all of them will (even if it's illegal) and many will also try to scam you out of your deposit if they see they can get away with it.