diff --git a/lib/SAML2/AuthnRequest.php b/lib/SAML2/AuthnRequest.php
index 44fa85c1d538b61875d86ae4802ff0e4f45b6b6d..2e2134f5f917cb0915ae5ef861a38acd43a1d408 100644
--- a/lib/SAML2/AuthnRequest.php
+++ b/lib/SAML2/AuthnRequest.php
@@ -68,6 +68,14 @@ class SAML2_AuthnRequest extends SAML2_Request {
 	private $protocolBinding;
 
 
+	/**
+	 * The index of the AssertionConsumerService.
+	 *
+	 * @var int|NULL
+	 */
+	private $assertionConsumerServiceIndex;
+
+
 	/**
 	 * What authentication context was requested.
 	 *
@@ -113,6 +121,10 @@ class SAML2_AuthnRequest extends SAML2_Request {
 			$this->protocolBinding = $xml->getAttribute('ProtocolBinding');
 		}
 
+		if ($xml->hasAttribute('AssertionConsumerServiceIndex')) {
+			$this->assertionConsumerServiceIndex = (int)$xml->getAttribute('AssertionConsumerServiceIndex');
+		}
+
 		$nameIdPolicy = SAML2_Utils::xpQuery($xml, './saml_protocol:NameIDPolicy');
 
 		if (!empty($nameIdPolicy)) {
@@ -332,6 +344,28 @@ class SAML2_AuthnRequest extends SAML2_Request {
 	}
 
 
+	/**
+	 * Retrieve the value of the AssertionConsumerServiceIndex attribute.
+	 *
+	 * @return int|NULL  The AssertionConsumerServiceIndex attribute.
+	 */
+	public function getAssertionConsumerServiceIndex() {
+		return $this->assertionConsumerServiceIndex;
+	}
+
+
+	/**
+	 * Set the value of the AssertionConsumerServiceIndex attribute.
+	 *
+	 * @param string|NULL $assertionConsumerServiceIndex  The AssertionConsumerServiceIndex attribute.
+	 */
+	public function setAssertionConsumerServiceIndex($assertionConsumerServiceIndex) {
+		assert('is_int($assertionConsumerServiceIndex) || is_null($assertionConsumerServiceIndex)');
+
+		$this->assertionConsumerServiceIndex = $assertionConsumerServiceIndex;
+	}
+
+
 	/**
 	 * Retrieve the RequestedAuthnContext.
 	 *