diff --git a/lib/SimpleSAML/Store.php b/lib/SimpleSAML/Store.php
index 134833fdfca18e2e6c42e3dbcae7a0278946456f..9447c44e556491e516ba7c53ad5b3f3531e709f9 100644
--- a/lib/SimpleSAML/Store.php
+++ b/lib/SimpleSAML/Store.php
@@ -48,7 +48,12 @@ abstract class SimpleSAML_Store {
 			self::$instance = new SimpleSAML_Store_SQL();
 			break;
 		default:
-			throw new SimpleSAML_Error_Exception('Unknown datastore type: ' . var_export($storeType, TRUE));
+			if (strpos($storeType, ':') === FALSE) {
+				throw new SimpleSAML_Error_Exception('Unknown datastore type: ' . var_export($storeType, TRUE));
+			}
+			/* Datastore from module. */
+			$className = SimpleSAML_Module::resolveClass($storeType, 'Store', 'SimpleSAML_Store');
+			self::$instance = new $className();
 		}
 
 		return self::$instance;