diff --git a/core/lib/Drupal/Core/Theme/ThemeManager.php b/core/lib/Drupal/Core/Theme/ThemeManager.php
index 31c10a7..3075833 100644
--- a/core/lib/Drupal/Core/Theme/ThemeManager.php
+++ b/core/lib/Drupal/Core/Theme/ThemeManager.php
@@ -317,7 +317,13 @@ public function render($hook, array $variables) {
     $output = '';
     if (isset($info['function'])) {
       if (function_exists($info['function'])) {
-        $output = SafeMarkup::set($info['function']($variables));
+        // Theme functions do not render via the theme engine, so the output
+        // is not autoescaped. However, we can only presume that the theme
+        // function has been written correctly and that the markup is safe.
+        //
+        // Therefore, the theme function itself is responsible for using
+        // SafeMarkup::set() as necessary, not this function, i.e.: render().
+        $output = $info['function']($variables);
       }
     }
     else {
