diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc
index 3e3853a..ee1092b 100644
--- a/core/includes/bootstrap.inc
+++ b/core/includes/bootstrap.inc
@@ -981,17 +981,18 @@ function variable_initialize($conf = array()) {
   else {
     // Cache miss. Avoid a stampede.
     $name = 'variable_init';
-    if (!lock()->acquire($name, 1)) {
+    $lock = Drupal::lock();
+    if (!$lock->acquire($name, 1)) {
       // Another request is building the variable cache.
       // Wait, then re-run this function.
-      lock()->wait($name);
+      $lock->wait($name);
       return variable_initialize($conf);
     }
     else {
       // Proceed with variable rebuild.
       $variables = array_map('unserialize', db_query('SELECT name, value FROM {variable}')->fetchAllKeyed());
       cache('bootstrap')->set('variables', $variables);
-      lock()->release($name);
+      $lock->release($name);
     }
   }
 
@@ -2431,29 +2432,15 @@ function drupal_get_bootstrap_phase() {
 /**
  * Retrieves the Drupal Container to standardize object construction.
  *
- * The container is built by the kernel and passed in to this function which
- * stores it statically. The container always contains the services from
- * \Drupal\Core\CoreBundle, the bundles of enabled modules and any other
- * bundles defined in $GLOBALS['conf']['container_bundles'].
- *
- * @see Drupal\Core\DrupalKernel
- *
- * @param Symfony\Component\DependencyInjection\ContainerInterface $new_container
- *   (optional) A new container instance to replace the current.
+ * @deprecated This function has been replaced by the \Drupal class. Use that
+ *   instead.
  *
  * @return Symfony\Component\DependencyInjection\ContainerInterface|bool
  *   The instance of the ContainerInterface used to set up and maintain
  *   object instances or FALSE if none exist yet.
  */
-function drupal_container(ContainerInterface $new_container = NULL) {
-  // We do not use drupal_static() here because we do not have a mechanism by
-  // which to reinitialize the stored objects, so a drupal_static_reset() call
-  // would leave Drupal in a nonfunctional state.
-  static $container;
-  if (isset($new_container)) {
-    $container = $new_container;
-  }
-  return $container;
+function drupal_container() {
+  return Drupal::getContainer();
 }
 
 /**
@@ -3174,7 +3161,7 @@ function drupal_classloader($class_loader = NULL) {
     // ones that use PEAR-like class prefixes in a single array, but the Symfony
     // class loader requires them to be registered separately.
     $prefixes_and_namespaces = require DRUPAL_ROOT . '/core/vendor/composer/autoload_namespaces.php';
-    $prefixes = array();
+    $prefixes = array('Drupal' => DRUPAL_ROOT . '/core/lib');
     $namespaces = array();
     foreach ($prefixes_and_namespaces as $key => $path) {
       // If the key:
@@ -3547,10 +3534,13 @@ function drupal_check_memory_limit($required, $memory_limit = NULL) {
 /**
  * Get locking layer instance.
  *
+ * @deprecated Use Drupal::lock() instead, or even better have the lock service
+ *   injected into your object.
+ *
  * @return Drupal\Core\Lock\LockBackendInterface
  */
 function lock() {
-  return drupal_container()->get('lock');
+  return Drupal::lock();
 }
 
 /**
diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc
index 6bbc5ff..c3294ee 100644
--- a/core/includes/install.core.inc
+++ b/core/includes/install.core.inc
@@ -367,7 +367,7 @@ function install_begin_request(&$install_state) {
       ))
       ->addMethodCall('setUserAgent', array('Drupal (+http://drupal.org/)'));
 
-    drupal_container($container);
+    Drupal::setContainer($container);
   }
 
   // Set up $language, so t() caller functions will still work.
diff --git a/core/lib/Drupal.php b/core/lib/Drupal.php
new file mode 100644
index 0000000..c1df74c
--- /dev/null
+++ b/core/lib/Drupal.php
@@ -0,0 +1,99 @@
+<?php
+
+/**
+ * @file
+ * Contains Drupal.
+ */
+
+use Symfony\Component\DependencyInjection\ContainerInterface;
+
+/**
+ * Static Service Container wrapper.
+ *
+ * Generally, code in Drupal should accept its dependencies via either
+ * constructor injection or setter method injection. However, there are cases,
+ * particularly in legacy procedural code, where that is infeasible. This
+ * class acts as a unified global accessor to arbitrary services within the
+ * system in order to ease the transition from procedural code to injected OO
+ * code.
+ *
+ * The container is built by the kernel and passed in to this class which stores
+ * it statically. The container always contains the services from
+ * \Drupal\Core\CoreBundle, the bundles of enabled modules and any other bundles
+ * defined in $GLOBALS['conf']['container_bundles'].
+ *
+ * @see \Drupal\Core\DrupalKernel
+ *
+ * @deprecated
+ *   This class exists only to support legacy code that cannot be dependency
+ *   injected. If your code needs it, that means your code should be refactored
+ *   eventually. This class will be removed once enough of Drupal has been
+ *   migrated to be fully injected.
+ */
+class Drupal {
+
+  /**
+   * The currently active container object.
+   *
+   * @var \Symfony\Component\DependencyInjection\ContainerInterface
+   */
+  protected static $container;
+
+  /**
+   * Sets a new global container.
+   *
+   * @param \Symfony\Component\DependencyInjection\ContainerInterface $container
+   *   A new container instance to replace the current.
+   */
+  public static function setContainer(ContainerInterface $container) {
+    static::$container = $container;
+  }
+
+  /**
+   * Returns the currently active global container.
+   *
+   * @deprecated This method is only useful for the testing environment, and as
+   *   a BC shiv for drupal_container(). It should not be used otherwise.
+   *
+   * @return \Symfony\Component\DependencyInjection\ContainerInterface
+   */
+  public static function getContainer() {
+    return static::$container;
+  }
+
+  /**
+   * Retrieves a service from the container.
+   *
+   * Use this method if the desired service is not one of those with a dedicated
+   * accessor method below. If it is listed below, those methods are preferred
+   * as they can return useful type hints.
+   *
+   * @param string $id
+   *   The ID of the service to retrieve.
+   * @return mixed
+   *   The specified service.
+   */
+  public static function service($id) {
+    return static::$container->get($id);
+  }
+
+  /**
+   * Returns the current primary database.
+   *
+   * @return \Drupal\Core\Database\Connection
+   *   The current active database's master connection.
+   */
+  public static function database() {
+    return static::$container->get('database');
+  }
+
+  /**
+  * Returns the locking layer instance.
+  *
+  * @return Drupal\Core\Lock\LockBackendInterface
+  */
+  public function lock() {
+    return static::$container->get('lock');
+  }
+
+}
diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php
index d56f503..a159628 100644
--- a/core/lib/Drupal/Core/DrupalKernel.php
+++ b/core/lib/Drupal/Core/DrupalKernel.php
@@ -326,7 +326,7 @@ protected function initializeContainer() {
     // Set the class loader which was registered as a synthetic service.
     $this->container->set('class_loader', $this->classLoader);
 
-    drupal_container($this->container);
+    \Drupal::setContainer($this->container);
   }
 
   /**
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
index da6a65f..4d4c216 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
@@ -894,7 +894,7 @@ protected function prepareEnvironment() {
 
     // Reset and create a new service container.
     $this->container = new ContainerBuilder();
-    drupal_container($this->container);
+    \Drupal::setContainer($this->container);
 
     // Unset globals.
     unset($GLOBALS['theme_key']);
@@ -1039,7 +1039,7 @@ protected function tearDown() {
     new Settings($this->originalSettings);
 
     // Restore original statics and globals.
-    drupal_container($this->originalContainer);
+    \Drupal::setContainer($this->originalContainer);
     $GLOBALS['config_directories'] = $this->originalConfigDirectories;
     if (isset($this->originalPrefix)) {
       drupal_valid_test_ua($this->originalPrefix);
