diff --git a/lib/_autoload_modules.php b/lib/_autoload_modules.php
index 5eb8d2fdb86ee2722144c26cc32d3abe29478e6d..1cbe074594535c02be2ea85e7a9520a5ddb16446 100644
--- a/lib/_autoload_modules.php
+++ b/lib/_autoload_modules.php
@@ -19,6 +19,14 @@
  */
 function temporaryLoader($class)
 {
+    // handle the upgrade to the latest version of XMLSecLibs using namespaces
+    if (strstr($class, 'XMLSec')) {
+        if (class_exists('\\RobRichards\\XMLSecLibs\\'.$class, true)) {
+            class_alias('\\RobRichards\\XMLSecLibs\\'.$class, $class);
+            return;
+        }
+    }
+
     if (!strstr($class, 'SimpleSAML_')) {
         return; // not a valid class name for old classes
     }