diff --git a/lib/SAML2/Utils.php b/lib/SAML2/Utils.php
index e2ae33502a8d478373e37790b71750ba4f2d610a..afcd53ec69e4f07960de8116a928c456fb23a46e 100644
--- a/lib/SAML2/Utils.php
+++ b/lib/SAML2/Utils.php
@@ -59,6 +59,10 @@ class SAML2_Utils {
 			if ($signedNode->isSameNode($root)) {
 				$rootSigned = TRUE;
 				break;
+			} elseif ($root->parentNode instanceof DOMDocument && $signedNode->isSameNode($root->ownerDocument)) {
+				/* $root is the root element of a signed document. */
+				$rootSigned = TRUE;
+				break;
 			}
 		}
 		if (!$rootSigned) {