diff --git a/modules/core/lib/Auth/UserPassOrgBase.php b/modules/core/lib/Auth/UserPassOrgBase.php
index 6583d34e1466762306cbbbe8f8f2f7e847729308..e07eccb4341a2e93eb6e1886f57d8a5a6162848c 100644
--- a/modules/core/lib/Auth/UserPassOrgBase.php
+++ b/modules/core/lib/Auth/UserPassOrgBase.php
@@ -27,6 +27,12 @@ abstract class sspmod_core_Auth_UserPassOrgBase extends SimpleSAML_Auth_Source {
 	const AUTHID = 'sspmod_core_Auth_UserPassOrgBase.AuthId';
 
 
+	/**
+	 * The key of the OrgId field in the state, identifies which org was selected.
+	 */
+	const ORGID = 'sspmod_core_Auth_UserPassOrgBase.SelectedOrg';
+
+
 	/**
 	 * What way do we handle the organization as part of the username.
 	 * Three values:
@@ -194,6 +200,10 @@ abstract class sspmod_core_Auth_UserPassOrgBase extends SimpleSAML_Auth_Source {
 			return $e->getErrorCode();
 		}
 
+		// Add the selected Org to the state
+		$state[self::ORGID] = $organization;
+		$state['PersistentAuthData'][] = self::ORGID;
+
 		$state['Attributes'] = $attributes;
 		SimpleSAML_Auth_Source::completeAuth($state);
 	}