diff --git a/taxonomy_menu.admin.inc b/taxonomy_menu.admin.inc
index 804d582..0275d32 100644
--- a/taxonomy_menu.admin.inc
+++ b/taxonomy_menu.admin.inc
@@ -71,6 +71,15 @@ function taxonomy_menu_form_taxonomy_form_vocabulary(&$form, &$form_state) {
     '#description' => t('Every time a term is added/deleted/modified, the corresponding menu link will be altered too.'),
     '#default_value' => taxonomy_menu_variable_get('sync', $vid, $defaults['sync']),
   );
+  // Max depth
+  $variable_name = _taxonomy_menu_build_variable('max_depth', $vid);
+  $form['taxonomy_menu']['max_depth'] = array(
+    '#type' => 'select',
+    '#title' => t('Max depth'),
+    '#description' => t('Limit how many levels of the taxonomy tree to process. Useful if you have a very large tree of taxonomy terms, and only want to provide a menu for the first several levels. 0 for no limit.'),
+    '#options' => array(0 => t('All'), 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9),
+    '#default_value' => taxonomy_menu_variable_get('max_depth', $vid, $defaults['max_depth']),
+  );
   // Rebuild
   $variable_name = _taxonomy_menu_build_variable('rebuild', $vid);
   $form['taxonomy_menu']['rebuild'] = array(
@@ -313,6 +322,7 @@ function taxonomy_menu_taxonomy_menu_vocabulary_settings() {
     'vocab_menu' => 0,
     'path' => 0,
     'sync' => TRUE,
+    'max_depth' => 0,
     'rebuild' => FALSE,
     'expanded' => TRUE,
     'term_item_description' => FALSE,
diff --git a/taxonomy_menu.module b/taxonomy_menu.module
index 3c20a4a..b232d96 100644
--- a/taxonomy_menu.module
+++ b/taxonomy_menu.module
@@ -64,7 +64,10 @@ function taxonomy_menu_menu_links_insert($vid) {
   // Get a list of all the taxonomy terms for that vocabulary and process them
   // using the bacth API.
   $menu_name = taxonomy_menu_variable_get('vocab_menu', $vid, FALSE);
-  $terms = taxonomy_get_tree($vid, 0, NULL, TRUE);
+  $depth = taxonomy_menu_variable_get('max_depth', $vid, 0);
+  if ($depth == 0)
+    $depth = NULL;
+  $terms = taxonomy_get_tree($vid, 0, $depth, TRUE);
   _taxonomy_menu_save_menu_links_batch($terms, $menu_name);
 
   menu_cache_clear($menu_name);
