diff --git a/modules/user/user.module b/modules/user/user.module
index 47ac642..92af7e3 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -2390,6 +2390,14 @@ function user_cancel($edit, $uid, $method) {
       array('_user_cancel', array($edit, $account, $method)),
     ),
   );
+
+  // After cancelling account, ensure that user is logged out.
+  if ($account->uid == $user->uid) {
+    // Batch API stores data in the session, so use the finished operation to
+    // manipulate the current user's session.
+    $batch['finished'] = '_user_cancel_session_destroy';
+  }
+
   batch_set($batch);
 
   // Batch processing is either handled via Form API or has to be invoked
@@ -2432,17 +2440,21 @@ function _user_cancel($edit, $account, $method) {
       break;
   }
 
-  // After cancelling account, ensure that user is logged out.
-  if ($account->uid == $user->uid) {
-    // Destroy the current session, and reset $user to the anonymous user.
-    session_destroy();
-  }
-
   // Clear the cache for anonymous users.
   cache_clear_all();
 }
 
 /**
+ * Finished batch processing callback for cancelling a user account.
+ *
+ * @see user_cancel()
+ */
+function _user_cancel_session_destroy() {
+  // Destroy the current session, and reset $user to the anonymous user.
+  session_destroy();
+}
+
+/**
  * Delete a user.
  *
  * @param $uid
diff --git a/modules/user/user.test b/modules/user/user.test
index b53db07..12ef33b 100644
--- a/modules/user/user.test
+++ b/modules/user/user.test
@@ -661,6 +661,9 @@ class UserCancelTestCase extends DrupalWebTestCase {
     $account = user_load($account->uid, TRUE);
     $this->assertTrue($account->status == 0, t('User has been blocked.'));
 
+    // Confirm that we didn't break Batch API by destroying the session.
+    $this->assertNoText(t('No active batch.'), "Batch API wasn't interrupted by the account cancellation.");
+
     // Confirm user is logged out.
     $this->assertNoText($account->name, t('Logged out.'));
   }
