diff --git a/cas.module b/cas.module
index 21d42ef..adc04c5 100644
--- a/cas.module
+++ b/cas.module
@@ -177,6 +177,7 @@ function cas_login_check($force_authentication = TRUE) {
   }
   else {
     $user = drupal_anonymous_user();
+    unset($_SESSION['phpCAS']);
     // Only display error messages only if the user intended to log in.
     if ($force_authentication) {
       drupal_set_message(t('No account found for %cas_name.', array('%cas_name' => $cas_name)));
diff --git a/cas.test b/cas.test
index 154efa4..ec42967 100644
--- a/cas.test
+++ b/cas.test
@@ -374,6 +374,12 @@ class CasUserTestCase extends CasTestHelper {
     $this->drupalGet('cas');
     $this->assertRaw(t('No account found for %cas_name.', array('%cas_name' => $cas_name)));
 
+    // Ensure that the login result is not cached.
+    $cas_name = $this->randomName();
+    $this->setCasUser($cas_name);
+    $this->drupalGet('cas');
+    $this->assertRaw(t('No account found for %cas_name.', array('%cas_name' => $cas_name)));
+
     // Test that the user is automatically registered.
     variable_set('cas_user_register', TRUE);
     $this->drupalGet('cas');
