diff --git a/imagecache.module b/imagecache.module
index 091b0fb..bb09fd7 100644
--- a/imagecache.module
+++ b/imagecache.module
@@ -402,6 +402,10 @@ function imagecache_cache() {
   $args = func_get_args();
   $preset = check_plain(array_shift($args));
   $path = implode('/', $args);
+  if (strpos(ltrim($path, '\/'), 'imagecache/') === 0 && !variable_get('imagecache_recursive', FALSE)) {
+    header('HTTP/1.0 403 Forbidden');
+    exit;
+  }
   _imagecache_cache($preset, $path);
 }
 
