diff --git a/modules/system/system.admin.inc b/modules/system/system.admin.inc
index cdcc78f..1174b0c 100644
--- a/modules/system/system.admin.inc
+++ b/modules/system/system.admin.inc
@@ -1840,6 +1840,13 @@ function system_file_system_settings() {
     );
   }
 
+  $form['file_make_unused_managed_files_temporary'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Mark unused files as temporary'),
+    '#default_value' => (bool) variable_get('file_make_unused_managed_files_temporary', FALSE),
+    '#description' => t('If checked, files for which all usages are removed are marked as temporary and then later on removed. <strong>Warning:</strong> There are currently known bugs with file usage counting, it is recommended to leave this disabled to prevent the loss of files.'),
+  );
+
   return system_settings_form($form);
 }
 
diff --git a/modules/system/system.module b/modules/system/system.module
index f014bc1..50f89b5 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -3035,6 +3035,11 @@ function system_cron() {
     ->condition('expiration', REQUEST_TIME, '<')
     ->execute();
 
+  // See http://drupal.org/node/2801777
+  $file_make_unused_managed_files_temporary = variable_get(
+    'file_make_unused_managed_files_temporary', FALSE
+  );
+
   // Remove temporary files that are older than DRUPAL_MAXIMUM_TEMP_FILE_AGE.
   // Use separate placeholders for the status to avoid a bug in some versions
   // of PHP. See http://drupal.org/node/352956.
@@ -3046,6 +3051,9 @@ function system_cron() {
     if ($file = file_load($row->fid)) {
       $references = file_usage_list($file);
       if (empty($references)) {
+        if (!$file_make_unused_managed_files_temporary) {
+          continue;
+        }
         if (!file_delete($file)) {
           watchdog('file system', 'Could not delete temporary file "%path" during garbage collection', array('%path' => $file->uri), WATCHDOG_ERROR);
         }
diff --git a/modules/system/system.test b/modules/system/system.test
index ec71093..59e64d7 100644
--- a/modules/system/system.test
+++ b/modules/system/system.test
@@ -904,12 +904,29 @@ class CronRunTestCase extends DrupalWebTestCase {
     $perm_new = file_save_data('');
     $this->assertTrue(file_exists($perm_new->uri), 'New permanent file was created correctly.');
 
+    variable_set('file_make_unused_managed_files_temporary', TRUE);
+
     // Run cron and then ensure that only the old, temp file was deleted.
     $this->cronRun();
     $this->assertFalse(file_exists($temp_old->uri), 'Old temp file was correctly removed.');
     $this->assertTrue(file_exists($temp_new->uri), 'New temp file was correctly ignored.');
     $this->assertTrue(file_exists($perm_old->uri), 'Old permanent file was correctly ignored.');
     $this->assertTrue(file_exists($perm_new->uri), 'New permanent file was correctly ignored.');
+
+    variable_set('file_make_unused_managed_files_temporary', FALSE);
+
+    // Temporary file that is older than DRUPAL_MAXIMUM_TEMP_FILE_AGE.
+    $temp_old = file_save_data('');
+    db_update('file_managed')
+      ->fields(array(
+        'status' => 0,
+        'timestamp' => 1,
+      ))
+      ->condition('fid', $temp_old->fid)
+      ->execute();
+
+    $this->cronRun();
+    $this->assertTrue(file_exists($perm_old->uri), 'Old temp file was correctly ignored.');
   }
 
   /**
