diff --git a/core/lib/Drupal/Core/Ajax/CloseDialogCommand.php b/core/lib/Drupal/Core/Ajax/CloseDialogCommand.php
new file mode 100644
index 0000000..a237239
--- /dev/null
+++ b/core/lib/Drupal/Core/Ajax/CloseDialogCommand.php
@@ -0,0 +1,24 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\Ajax\CloseDialogCommand.
+ */
+
+namespace Drupal\Core\Ajax;
+
+/**
+ * Defines an AJAX command that closes the current active dialog.
+ */
+class CloseDialogCommand implements CommandInterface {
+
+  /**
+   * Implements \Drupal\Core\Ajax\CommandInterface::render().
+   */
+  public function render() {
+    return array(
+      'command' => 'closeDialog',
+    );
+  }
+
+}
diff --git a/core/lib/Drupal/Core/Ajax/OpenDialogCommand.php b/core/lib/Drupal/Core/Ajax/OpenDialogCommand.php
new file mode 100644
index 0000000..5def98e
--- /dev/null
+++ b/core/lib/Drupal/Core/Ajax/OpenDialogCommand.php
@@ -0,0 +1,54 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\Ajax\OpenDialogCommand.
+ */
+
+namespace Drupal\Core\Ajax;
+
+/**
+ * Defines an AJAX command to open certain content in a dialog.
+ */
+class OpenDialogCommand extends InsertCommand {
+
+ /**
+   * Stores the title of the dialog.
+   *
+   * @var string
+   */
+  protected $title;
+
+  /**
+   * Constructs an InsertDialogCommand object.
+   *
+   * @param string $title
+   *   The title of the dialog.
+   * @param string $html
+   *   String of HTML that will replace the matched element(s).
+   * @param array $settings
+   *   An array of JavaScript settings to be passed to any attached behaviors.
+   * @internal param string $selector A CSS selector.*   A CSS selector.
+   */
+  public function __construct($title, $html, array $settings = NULL) {
+      $this->title = $title;
+      $this->html = $html;
+      $this->settings = $settings;
+    }
+
+  /**
+   * Implements Drupal\Core\Ajax\CommandInterface:render().
+   */
+  public function render() {
+    // @todo Should it be able to control the dialog settings?
+    return array(
+      'command' => 'insert',
+      'method' => NULL,
+      'title' => $this->title,
+      'selector' => '#drupal-modal',
+      'data' => $this->html,
+      'settings' => $this->settings,
+    );
+  }
+
+}
diff --git a/core/misc/dialog.ajax.js b/core/misc/dialog.ajax.js
new file mode 100644
index 0000000..95e51ec
--- /dev/null
+++ b/core/misc/dialog.ajax.js
@@ -0,0 +1,42 @@
+/**
+ * @file
+ *
+ * Integrates the dialog API with the drupal AJAX commands.
+ */
+
+(function ($, Drupal, drupalSettings) {
+
+"use strict";
+
+  /**
+    * Command to close a modal dialog.
+    */
+  Drupal.ajax.prototype.commands.closeDialog = function (ajax, response, status) {
+    var $modal = $("#drupal-modal");
+    if ($modal.length) {
+      $modal.dialog.close(1);
+    }
+  };
+
+  /**
+   * Command to open a modal dialog.
+   */
+  Drupal.ajax.prototype.commands.openDialog = function (ajax, response, status) {
+    var $modal = $('#drupal-modal');
+    // Apply ajax settings.
+    $($modal).find('.ajax').once('ajax', function () {
+      var element_settings = {};
+      element_settings.progress = { 'type': null };
+      element_settings.dialog = {
+        modal: true
+      };
+
+      if ($(this).attr('href')) {
+        element_settings.url = $(this).attr('href');
+      }
+      var base = $(this).attr('id');
+      Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings);
+    });
+  };
+
+})(jQuery, Drupal, drupalSettings);
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index eaaebc2..61b70ea 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -1148,6 +1148,22 @@ function system_library_info() {
     ),
   );
 
+  // Drupal's dialog ajax integration.
+  $libraries['drupal.dialog.ajax'] = array(
+    'title' => 'Drupal Dialog AJAX',
+    'version' => VERSION,
+    'js' => array(
+      'core/misc/dialog.ajax.js' => array('group' => JS_LIBRARY, 'weight' => 3),
+    ),
+    'dependencies' => array(
+      array('system', 'jquery'),
+      array('system', 'drupal'),
+      array('system', 'drupalSettings'),
+      array('system', 'drupal.ajax'),
+      array('system', 'drupal.dialog'),
+    ),
+  );
+
   // Drupal's states library.
   $libraries['drupal.states'] = array(
     'title' => 'Drupal states',
diff --git a/core/modules/system/tests/modules/ajax_test/ajax_test.module b/core/modules/system/tests/modules/ajax_test/ajax_test.module
index efb1966..d59ab54 100644
--- a/core/modules/system/tests/modules/ajax_test/ajax_test.module
+++ b/core/modules/system/tests/modules/ajax_test/ajax_test.module
@@ -1,5 +1,8 @@
 <?php
 
+use Drupal\Core\Ajax\AjaxResponse;
+use Drupal\Core\Ajax\OpenDialogCommand;
+
 /**
  * @file
  * Helper module for Ajax framework tests.
@@ -36,6 +39,16 @@ function ajax_test_menu() {
     'page callback' => 'ajax_test_dialog_contents',
     'access callback' => TRUE,
   );
+  $items['ajax-test/dialog-commands'] = array(
+    'title' => 'AJAX Dialog commands',
+    'page callback' => 'ajax_test_dialog_commands',
+    'access callback' => TRUE,
+  );
+  $items['ajax-test/dialog-commands-close'] = array(
+    'title' => 'AJAX Dialog commands: close',
+    'page callback' => 'ajax_test_dialog_commands_close',
+    'access callback' => TRUE,
+  );
   return $items;
 }
 
@@ -95,6 +108,7 @@ function ajax_test_dialog() {
 
   // Dialog behavior applied to a button.
   $build['form'] = drupal_get_form('ajax_test_dialog_form');
+  $build['form']['#attached']['library'][] = array('system', 'drupal.dialog.ajax');
 
   // Dialog behavior applied to a #type => 'link'.
   $build['link'] = array(
@@ -125,6 +139,13 @@ function ajax_test_dialog() {
           'wrapper' => 'ajax-test-dialog-wrapper-2',
         ),
       ),
+      'link4' => array(
+        'title' => 'Link 4 (modal with ajax commands)',
+        'href' => 'ajax-test/dialog-commands',
+        'ajax' => array(
+          'dialog' => array('modal' => TRUE),
+        ),
+      ),
     ),
   );
   return $build;
@@ -181,3 +202,27 @@ function ajax_test_dialog_contents() {
   );
 }
 
+/**
+ * Menu callback: Returns ajax commands to open a dialog.
+ */
+function ajax_test_dialog_commands() {
+  $response = new AjaxResponse();
+
+  $content = array(
+    'content' => array(
+      '#markup' => 'Example message',
+    ),
+    'cancel'=> array(
+      '#type' => 'link',
+      '#title' => 'Cancel',
+      '#href' => 'ajax-test/dialog-commands-close',
+      '#ajax' => array(),
+    ),
+  );
+
+  $content = drupal_render($content);
+  $response->addCommand(new OpenDialogCommand(t('Title'), $content));
+
+  return $response;
+}
+
