diff --git a/modules/select2_bef/src/Controller/Select2BefFormStaticController.php b/modules/select2_bef/src/Controller/Select2BefFormStaticController.php
index 2a20dd7..2a61425 100644
--- a/modules/select2_bef/src/Controller/Select2BefFormStaticController.php
+++ b/modules/select2_bef/src/Controller/Select2BefFormStaticController.php
@@ -68,11 +68,66 @@ class Select2BefFormStaticController {
     if ($bef[$key]['more_options']['limited_search'] == '1') {
       $form[$key]['#attributes']['data-minimum-search-length'] = $bef[$key]['more_options']['minimum_search_length'];
     }
+    // Include the flags icons if enabled in BEF settings.
+    if ($bef[$key]['more_options']['include_flags'] == '1') {
+      static::includeIcons($form, $filter->definition, $key);
+    }
     // Attach library.
     static::addLibrary($libraries);
   }
 
   /**
+   * Include flags icons.
+   *
+   * @param array &$form
+   *   Form array.
+   * @param array $filter_definition
+   *   Filter's definition data.
+   * @param string $key
+   *   Element's key.
+   */
+  protected static function includeIcons(&$form, $filter_definition, $key) {
+    // Create a map of country or language dependent classes.
+    $flags       = [];
+    // Get some additional data from the filter's definition data array.
+    $field_name  = isset($filter_definition['field_name']) ? $filter_definition['field_name'] : $filter_definition['entity field'];
+    $entity_type = $filter_definition['entity_type'];
+    // Get the field's definition object to know the field's type.
+    /** @var \Drupal\Core\Field\FieldDefinitionInterface $definition */
+    $definition = \Drupal::service('entity_field.manager')
+      ->getFieldStorageDefinitions($entity_type)[$field_name];
+    // Use an appropriate mapper service relatively to the field's type.
+    $mapper = !is_null($definition) && $definition->getType() == 'country'
+      ? \Drupal::service('flags.mapping.country')
+      : \Drupal::service('flags.mapping.language');
+    foreach (array_keys($form[$key]['#options']) as $key) {
+      if ($key == '***LANGUAGE_language_interface***' || $key == '***LANGUAGE_site_default***') {
+        continue;
+      }
+      $flags[$key] = [
+        'flag',
+        'flag-' . $mapper->map($key),
+        $mapper->getExtraClasses()[0],
+      ];
+    }
+    // Merge these values to have all countries
+    // and languages flags in the same place to prevent missing flags icons.
+    if (!isset($form['#attached']['drupalSettings']['flagsClasses'])) {
+      $form['#attached']['drupalSettings']['flagsClasses'] = [];
+    }
+    $form['#attached']['drupalSettings']['flagsClasses'] += $flags;
+    // We have to use field's column name for views,
+    // e.g. FIELD_NAME_value instead of FIELD_NAME.
+    // Note: small workaround for the entity properties like langcode.
+    if (!isset($filter_definition['field'])) {
+      $filter_definition['field'] = $filter_definition['entity field'];
+    }
+    $form['#attached']['drupalSettings']['flagsFields'][$filter_definition['field']] = TRUE;
+    // Attach the flags library.
+    $form['#attached']['library'][] = 'flags/flags';
+  }
+
+  /**
    * Handle single-autocomplete widget.
    *
    * @param array &$form
diff --git a/modules/select2_bef/src/Plugin/views/exposed_form/BetterExposedFilters.php b/modules/select2_bef/src/Plugin/views/exposed_form/BetterExposedFilters.php
index 726a428..f88cd4b 100644
--- a/modules/select2_bef/src/Plugin/views/exposed_form/BetterExposedFilters.php
+++ b/modules/select2_bef/src/Plugin/views/exposed_form/BetterExposedFilters.php
@@ -147,6 +147,9 @@ class BetterExposedFilters extends BetterExposedFiltersOrigin {
           ],
         ];
       }
+      if (self::isField($name) || $name == 'langcode') {
+        $this->addIncludeIconsOption($bef, $name, $settings);
+      }
     }
   }
 
@@ -210,6 +213,39 @@ class BetterExposedFilters extends BetterExposedFiltersOrigin {
   }
 
   /**
+   * Add "Include flags icons" option if all dependencies are met.
+   *
+   * @param array &$bef
+   *   BEF options form.
+   * @param string $name
+   *   Element's name.
+   * @param array $settings
+   *   BEF settings array.
+   */
+  protected function addIncludeIconsOption(&$bef, $name, $settings) {
+    // Check if the field is of allowed type to include flags icons.
+    $types = ['language_field', 'language', 'country', 'langcode'];
+    if (in_array($this->getFieldType($name), $types)) {
+      if (\Drupal::moduleHandler()->moduleExists('flags')) {
+        // Add a new option to the settings form.
+        $bef[$name]['more_options']['include_flags'] = [
+          '#type'          => 'checkbox',
+          '#title'         => $this->t('Include flags icons'),
+          '#default_value' => $settings[$name]['more_options']['include_flags'],
+          '#states'        => [
+            // Make it invisible for any widgets except Select2 Boxes.
+            'visible' => [
+              ":input[name=\"exposed_form_options[bef][$name][bef_format]\"]" => [
+                'value' => 'select2boxes_autocomplete_list',
+              ],
+            ],
+          ],
+        ];
+      }
+    }
+  }
+
+  /**
    * Check if the name is a field name.
    *
    * @param string $name
@@ -236,6 +272,29 @@ class BetterExposedFilters extends BetterExposedFiltersOrigin {
   }
 
   /**
+   * Get field's type.
+   *
+   * @param string $name
+   *   Field's BEF name.
+   *
+   * @return string
+   *   Field's type.
+   */
+  protected function getFieldType($name) {
+    if (stripos($name, '_target_id') !== FALSE) {
+      $name = static::convertDatabaseFieldToFieldname($name);
+    }
+    elseif (stripos($name, '_value') !== FALSE) {
+      $name = str_replace('_value', '', $name);
+    }
+    $entity_type = $this->view->getBaseEntityType()->id();
+    /** @var \Drupal\Core\Field\FieldDefinitionInterface $field_definition */
+    $field_definition = \Drupal::service('entity_field.manager')
+      ->getFieldStorageDefinitions($entity_type)[$name];
+    return $field_definition->getType();
+  }
+
+  /**
    * Build reference bundles list.
    *
    * @param string $field
