diff --git a/src/scripts/location-importer.in b/src/scripts/location-importer.in
index d0384b5..d8f9cbf 100644
--- a/src/scripts/location-importer.in
+++ b/src/scripts/location-importer.in
@@ -1421,7 +1421,15 @@ class CLI(object):
 							log.debug("Could not parse network: %s" % network)
 							continue
 
-						# XXX Check the country code
+						# Strip any excess whitespace from country codes
+						if country:
+							country = country.strip()
+
+						# Check the country code
+						if not location.country_code_is_valid(country):
+							log.warning("Invalid country code in Geofeed %s: %s" \
+								% (geofeed.url, country))
+							continue
 
 						# Write this into the database
 						self.db.execute("""
