diff --git a/node_import.inc b/node_import.inc
index 6389f6e..5246e2c 100644
--- a/node_import.inc
+++ b/node_import.inc
@@ -241,6 +241,11 @@ function node_import_fields($type, $reset = FALSE) {
           $fields[$type][$fieldname]['preprocess'][] = 'node_import_check_user_reference';
           $fields[$type][$fieldname]['tips'][] = t('User reference (by uid, name or mail).');
           break;
+        
+        case 'role_reference':
+          $fields[$type][$fieldname]['preprocess'][] = 'node_import_check_role_reference';
+          $fields[$type][$fieldname]['tips'][] = t('Role reference (by rid or name).');
+          break;
 
         case 'weight':
           $fields[$type][$fieldname]['preprocess'][] = 'node_import_check_weight';
@@ -1334,6 +1339,40 @@ function node_import_check_user_reference(&$value, $field, $options, $preview) {
 }
 
 /**
+ * Check if the value is a valid role (by rid or name).
+ *
+ * Uses: $field['output_format']. Either 'rid' (default) or 'name.
+ */
+function node_import_check_role_reference(&$value, $field, $options, $preview) {
+  if (($rid = node_import_get_object('role', $value)) !== NULL ||
+      ($rid = db_result(db_query("SELECT rid FROM {role} WHERE rid = %d OR LOWER(name) = '%s' LIMIT 1", is_numeric($value) && intval($value) > 0 ? $value : -1, drupal_strtolower($value))))) {
+
+    node_import_set_object('role', $value, $rid);
+    $value = $rid;
+
+    $field['output_format'] = isset($field['output_format']) ? $field['output_format'] : 'rid';
+    switch ($field['output_format']) {
+      case 'name':
+        if (($name = node_import_get_object('role:name', $rid)) ||
+            ($name = db_result(db_query("SELECT name FROM {role} WHERE rid = %d LIMIT 1", $rid)))) {
+          $value = $name;
+          node_import_set_object('role:name', $rid, $name);
+        }
+        break;
+
+      case 'rid':
+      default:
+        break;
+    }
+
+    return TRUE;
+  }
+
+  node_import_input_error(t('Input error: %value is not allowed for %name (not a role).', array('%value' => $value, '%name' => $field['title'])));
+  return FALSE;
+}
+
+/**
  * Check if the value is in the list of allowed values (by key or value).
  *
  * Uses: $field['allowed_values'].
diff --git a/supported/user.inc b/supported/user.inc
index f43e6a6..f5f0f07 100644
--- a/supported/user.inc
+++ b/supported/user.inc
@@ -37,6 +37,15 @@ function node_import_create_user($type, $values, $preview) {
     $output .= '<h3>' . check_plain($values['name']) . "</h3>\n";
     $output .= "<ul>\n";
     $output .= '<li>' . t('Email') . ': ' . check_plain($values['mail']) . "</li>\n";
+    // roles
+    if (!empty($values['roles'])) {
+      $values['roles'] = array_filter($values['roles']);
+      $roles = user_roles();
+      foreach ((array)$values['roles'] as $rid_k => $rid) {
+        $roles_names[] =  $roles[$rid_k];
+      }
+      $output .= '<li>' . t('Roles'). ': ' . check_plain(implode(', ', $roles_names)) . "</li>\n";
+    }
 
     foreach ( $fields as $fname => $field ) {
       // ignore the standard fields
@@ -46,6 +55,7 @@ function node_import_create_user($type, $values, $preview) {
         case 'pass':
         case 'status':
         case 'notify':
+        case 'roles':
           continue(2);
       }
 
@@ -67,6 +77,14 @@ function node_import_create_user($type, $values, $preview) {
     $form_id = 'user_register';
 
     $values['op'] = t('Save');
+
+    if (!empty($values['roles'])) {
+      // We are unsetting this, otherwise it will trigger the "An illegal choice
+      // has been detected. Please contact the site administrator.".
+      // I am not sure why this happenes, but this should prevent it.
+      unset($values['roles'][DRUPAL_AUTHENTICATED_RID]);
+    }
+
     $form_state = array(
       'values' => $values,
     );
@@ -85,6 +103,7 @@ function node_import_create_user($type, $values, $preview) {
         case 'pass':
         case 'status':
         case 'notify':
+        case 'roles':
           continue(2);
       }
 
@@ -141,6 +160,14 @@ function user_node_import_fields($type) {
       'module' => 'user',
       'is_mappable' => FALSE,
     );
+
+    $fields['roles'] = array(
+      'title' => t('Roles'),
+      'module' => 'user',
+      'is_mappable' => TRUE,
+      'has_multiple' => TRUE,
+      'input_format' => 'role_reference'
+    );
   }
 
   return $fields;
@@ -190,6 +217,34 @@ function user_node_import_defaults($type, $defaults, $fields, $map) {
       '#title' => t('Notify user of new account'),
       '#default_value' => isset($defaults['notify']) ? $defaults['notify'] : '0',
     );
+
+    if (user_access('administer permissions')) {
+      $roles = user_roles(TRUE);
+
+      // The disabled checkbox subelement for the 'authenticated user' role
+      // must be generated separately and added to the checkboxes element,
+      // because of a limitation in D6 FormAPI not supporting a single disabled
+      // checkbox within a set of checkboxes.
+      // TODO: This should be solved more elegantly. See issue #119038.
+      $checkbox_authenticated = array(
+        '#type' => 'checkbox',
+        '#title' => $roles[DRUPAL_AUTHENTICATED_RID],
+        '#default_value' => TRUE,
+        '#disabled' => TRUE,
+      );
+
+      unset($roles[DRUPAL_AUTHENTICATED_RID]);
+      if ($roles) {
+        $default = isset($defaults['roles']) ? array_keys($defaults['roles']) : array();
+        $form['roles'] = array(
+          '#type' => 'checkboxes',
+          '#title' => t('Roles'),
+          '#default_value' => isset($defaults['roles']) ? $defaults['roles'] : array(),
+          '#options' => $roles,
+          DRUPAL_AUTHENTICATED_RID => $checkbox_authenticated,
+        );
+      }
+    }
   }
 
   return $form;
