diff --git a/core/includes/menu.inc b/core/includes/menu.inc
index c7fcd92..159db4c 100644
--- a/core/includes/menu.inc
+++ b/core/includes/menu.inc
@@ -1254,7 +1254,10 @@ function menu_tree_page_data($menu_name, $max_depth = NULL, $only_active_trail =
           }
           $parents = $active_trail;
 
-          $expanded = variable_get('menu_expanded', array());
+          $expanded = state()->get('menu_expanded');
+          if (!$expanded) {
+            $expanded = array();
+          }
           // Check whether the current menu has any links set to be expanded.
           if (!$only_active_trail && in_array($menu_name, $expanded)) {
             // Collect all the links set to be expanded, and then add all of
@@ -2264,10 +2267,11 @@ function theme_menu_local_tasks(&$variables) {
  *
  * @return
  *   An array of menu machine names, in order of preference. The
- *   'menu_default_active_menus' variable may be used to assert a menu order
- *   different from the order of creation, or to prevent a particular menu from
- *   being used at all in the active trail.
- *   E.g., $conf['menu_default_active_menus'] = array('tools', 'main')
+ *   'system.menu.active_menus_default' config item may be used to assert a menu
+ *   order different from the order of creation, or to prevent a particular menu
+ *   from being used at all in the active trail.
+ *   E.g., $conf['system.menu']['active_menus_default'] = array('tools',
+ *   'main').
  */
 function menu_set_active_menu_names($menu_names = NULL) {
   $active = &drupal_static(__FUNCTION__);
@@ -2276,7 +2280,11 @@ function menu_set_active_menu_names($menu_names = NULL) {
     $active = $menu_names;
   }
   elseif (!isset($active)) {
-    $active = variable_get('menu_default_active_menus', array_keys(menu_list_system_menus()));
+    $config = config('system.menu');
+    $active = $config->get('active_menus_default');
+    if (empty($active)) {
+      $active = array_keys(menu_list_system_menus()));
+    }
   }
   return $active;
 }
@@ -3275,7 +3283,7 @@ function _menu_clear_page_cache() {
  */
 function _menu_set_expanded_menus() {
   $names = db_query("SELECT menu_name FROM {menu_links} WHERE expanded <> 0 GROUP BY menu_name")->fetchCol();
-  variable_set('menu_expanded', $names);
+  state()->set('menu_expanded', $names);
 }
 
 /**
diff --git a/core/modules/menu/menu.module b/core/modules/menu/menu.module
index 22f5dd7..1a21c13 100644
--- a/core/modules/menu/menu.module
+++ b/core/modules/menu/menu.module
@@ -274,11 +274,16 @@ function menu_save($menu) {
     case SAVED_NEW:
       // Make sure the menu is present in the active menus variable so that its
       // items may appear in the menu active trail.
-      // @see menu_set_active_menu_names()
-      $active_menus = variable_get('menu_default_active_menus', array_keys(menu_get_menus()));
+      // See menu_set_active_menu_names().
+      $config = config('system.menu');
+
+      $active_menus = $config->get('active_menus_default');
+      if (empty($active_menus)) {
+        $active_menus = array_keys(menu_get_menus());
+      }
       if (!in_array($menu['menu_name'], $active_menus)) {
         $active_menus[] = $menu['menu_name'];
-        variable_set('menu_default_active_menus', $active_menus);
+        $config->set('active_menus_default', $active_menus);
       }
 
       module_invoke_all('menu_insert', $menu);
diff --git a/core/modules/system/config/system.menu.yml b/core/modules/system/config/system.menu.yml
new file mode 100644
index 0000000..e73636c
--- /dev/null
+++ b/core/modules/system/config/system.menu.yml
@@ -0,0 +1 @@
+active_menus_default: []
