diff --git a/profile2.info b/profile2.info
index df64223..986718f 100644
--- a/profile2.info
+++ b/profile2.info
@@ -4,5 +4,7 @@ core = 7.x
 files[] = profile2.admin.inc
 files[] = profile2.info.inc
 files[] = profile2.test
+; views handlers
+files[] = views/profile2_handler_relationship_user_profile.inc
 dependencies[] = entity
 configure = admin/structure/profiles
\ No newline at end of file
diff --git a/profile2.module b/profile2.module
index b34bca8..3237407 100644
--- a/profile2.module
+++ b/profile2.module
@@ -715,3 +715,12 @@ function profile2_user_get_properties($account, array $options, $name) {
   return $profile ? $profile : NULL;
 }
 
+/**
+ * Implementation of hook_views_api().
+ */
+function profile2_views_api() {
+  return array(
+    'api' => '3.0-alpha1',
+    'path' => drupal_get_path('module', 'profile2') . '/views',
+  );
+}
diff --git a/views/profile2.views.inc b/views/profile2.views.inc
new file mode 100644
index 0000000..0efe79b
--- /dev/null
+++ b/views/profile2.views.inc
@@ -0,0 +1,15 @@
+<?php
+/**
+ * @file
+ * Adds support for Views.
+ */
+
+/**
+ * Implementation of hook_views_data_alter().
+ *
+ * EntityAPI provides the basics; we alter to add refinements.
+ */
+function profile2_views_data_alter(&$data) {
+  // Use our relationship handler for user->profile to give limiting options.
+  $data['users']['profile']['relationship']['handler'] = 'profile2_handler_relationship_user_profile';
+}
diff --git a/views/profile2_handler_relationship_user_profile.inc b/views/profile2_handler_relationship_user_profile.inc
new file mode 100644
index 0000000..38b6dbc
--- /dev/null
+++ b/views/profile2_handler_relationship_user_profile.inc
@@ -0,0 +1,87 @@
+<?php
+/**
+ * @file
+ * Contains the handler for relationships from users to profiles.
+ */
+
+/**
+ * The relationship handler for a user's profile, with option to limit by type.
+ */
+class profile2_handler_relationship_user_profile extends views_handler_relationship {
+  function option_definition() {
+    $options = parent::option_definition();
+    $options['profile_type'] = array('default' => array());
+
+    return $options;
+  }
+
+  /**
+   * Add a profile type option.
+   */
+  function options_form(&$form, &$form_state) {
+    parent::options_form($form, $form_state);
+
+    foreach (profile2_get_types() as $type => $info) {
+      $options[$type] = $info->label;
+    }
+
+    $form['profile_type'] = array(
+      '#type' => 'checkboxes',
+      '#options' => $options,
+      '#default_value' => $this->options['profile_type'],
+      '#title' => t('Profile types'),
+      '#description' => t('Restrict this relationship to one or more profile types. Selecting more than one type will produce duplicate rows.'),
+    );
+  }
+
+  /**
+   * Called to implement a relationship in a query.
+   *
+   * Mostly the same as the parent method, except we add an extra clause to
+   * the join.
+   */
+  function query() {
+    // Figure out what base table this relationship brings to the party.
+    $table_data = views_fetch_data($this->definition['base']);
+    $base_field = empty($this->definition['base field']) ? $table_data['table']['base']['field'] : $this->definition['base field'];
+
+    $this->ensure_my_table();
+
+    $def = $this->definition;
+    $def['table'] = $this->definition['base'];
+    $def['field'] = $base_field;
+    $def['left_table'] = $this->table_alias;
+    $def['left_field'] = $this->field;
+    if (!empty($this->options['required'])) {
+      $def['type'] = 'INNER';
+    }
+
+    // Add an extra clause to the join if there are profile types selected.
+    $profile_types = $this->options['profile_type'];
+    if (count($profile_types)) {
+      $def['extra'] = array(
+        array(
+          // The table and the IN operator are implicit.
+          'field' => 'type',
+          'value' => $profile_types,
+        ),
+      );
+    }
+
+    if (!empty($def['join_handler']) && class_exists($def['join_handler'])) {
+      $join = new $def['join_handler'];
+    }
+    else {
+      $join = new views_join();
+    }
+
+    $join->definition = $def;
+    $join->construct();
+    $join->adjusted = TRUE;
+
+    // use a short alias for this:
+    $alias = $def['table'] . '_' . $this->table;
+
+    $this->alias = $this->query->add_relationship($alias, $join, $this->definition['base'], $this->relationship);
+  }
+}
