diff --git a/lib/SimpleSAML/Error/MetadataNotFound.php b/lib/SimpleSAML/Error/MetadataNotFound.php
index 5065a7568082046868b9e5419feebab9022c9243..fe730ff388d25020a5aebf4fa166866dd5320d46 100644
--- a/lib/SimpleSAML/Error/MetadataNotFound.php
+++ b/lib/SimpleSAML/Error/MetadataNotFound.php
@@ -21,7 +21,7 @@ class MetadataNotFound extends Error
      */
     public function __construct(string $entityId)
     {
-        $this->includeTemplate = 'core:no_metadata.tpl.php';
+        $this->includeTemplate = 'core:no_metadata.twig';
         parent::__construct([
                 'METADATANOTFOUND',
                 '%ENTITYID%' => htmlspecialchars(var_export($entityId, true))
diff --git a/lib/SimpleSAML/Error/NoState.php b/lib/SimpleSAML/Error/NoState.php
index 599bd1cb2d3f7e1a410b5dff9c8421d83247ea51..8071d84c7e999c57cb389a202a2086711cfa1e70 100644
--- a/lib/SimpleSAML/Error/NoState.php
+++ b/lib/SimpleSAML/Error/NoState.php
@@ -18,7 +18,7 @@ class NoState extends Error
      */
     public function __construct()
     {
-        $this->includeTemplate = 'core:no_state.tpl.php';
+        $this->includeTemplate = 'core:no_state.twig';
         parent::__construct('NOSTATE');
     }
 }
diff --git a/lib/SimpleSAML/XHTML/Template.php b/lib/SimpleSAML/XHTML/Template.php
index bc30e11df43ed7e9fe99b980fb5afbfb33b5e5c0..76b5f21316c9de30c662a9f25fbef1a2df97f129 100644
--- a/lib/SimpleSAML/XHTML/Template.php
+++ b/lib/SimpleSAML/XHTML/Template.php
@@ -545,8 +545,6 @@ class Template extends Response
      */
     private function findTemplatePath(string $template, bool $throw_exception = true): ?string
     {
-        $extensions = ['.tpl.php', '.php'];
-
         list($templateModule, $templateName) = $this->findModuleAndTemplateName($template);
         $templateModule = ($templateModule !== null) ? $templateModule : 'default';
 
@@ -566,11 +564,6 @@ class Template extends Response
         }
 
         $filename = $this->normalizeTemplateName($filename);
-        foreach ($extensions as $extension) {
-            if (file_exists($filename . $extension)) {
-                return $filename . $extension;
-            }
-        }
 
         // not found in current theme
         Logger::debug(
@@ -589,11 +582,6 @@ class Template extends Response
         }
 
         $filename = $this->normalizeTemplateName($filename);
-        foreach ($extensions as $extension) {
-            if (file_exists($filename . $extension)) {
-                return $filename . $extension;
-            }
-        }
 
         // not found in default template
         if ($throw_exception) {
diff --git a/lib/SimpleSAML/XHTML/TemplateLoader.php b/lib/SimpleSAML/XHTML/TemplateLoader.php
index 919ded5d936f15d45f0a3d88b7b1ffe8c1c92b2b..f48ae7c543a24f35878a1d29f0b235bddc07c385 100644
--- a/lib/SimpleSAML/XHTML/TemplateLoader.php
+++ b/lib/SimpleSAML/XHTML/TemplateLoader.php
@@ -51,10 +51,6 @@ class TemplateLoader extends \Twig\Loader\FilesystemLoader
         if (strpos($name, ':')) {
             // we have our old SSP format
             list($namespace, $shortname) = explode(':', $name, 2);
-            $shortname = strtr($shortname, [
-                '.tpl.php' => '.twig',
-                '.php' => '.twig',
-            ]);
             return [$namespace, $shortname];
         }
         return [$default, $name];
diff --git a/modules/core/www/authenticate.php b/modules/core/www/authenticate.php
index 680ece576c37f9989fc7f36ecb0198ca31c24c2f..d46da93e3f6178bafa6c8c63d834460932e922ad 100644
--- a/modules/core/www/authenticate.php
+++ b/modules/core/www/authenticate.php
@@ -5,7 +5,7 @@ use Webmozart\Assert\Assert;
 $config = \SimpleSAML\Configuration::getInstance();
 
 if (!array_key_exists('as', $_REQUEST)) {
-    $t = new \SimpleSAML\XHTML\Template($config, 'core:authsource_list.tpl.php');
+    $t = new \SimpleSAML\XHTML\Template($config, 'core:authsource_list.twig');
 
     $t->data['sources'] = \SimpleSAML\Auth\Source::getSources();
     $t->send();
diff --git a/modules/core/www/cardinality_error.php b/modules/core/www/cardinality_error.php
index 135493d50a30e22dd8f44fd6fe84103dd039de3a..cae3cbf4e0d17417c7202088b60cae31fc59eaf5 100644
--- a/modules/core/www/cardinality_error.php
+++ b/modules/core/www/cardinality_error.php
@@ -18,7 +18,7 @@ $session = \SimpleSAML\Session::getSessionFromRequest();
     . ' ' . $state['saml:sp:IdP'] . ' ' . implode(',', array_keys($state['core:cardinality:errorAttributes'])));
 
 $globalConfig = \SimpleSAML\Configuration::getInstance();
-$t = new \SimpleSAML\XHTML\Template($globalConfig, 'core:cardinality_error.tpl.php');
+$t = new \SimpleSAML\XHTML\Template($globalConfig, 'core:cardinality_error.twig');
 $t->data['cardinalityErrorAttributes'] = $state['core:cardinality:errorAttributes'];
 if (isset($state['Source']['auth'])) {
     $t->data['LogoutURL'] = \SimpleSAML\Module::getModuleURL(
diff --git a/modules/core/www/frontpage_auth.php b/modules/core/www/frontpage_auth.php
index cd6546f13124ead3c1b80eaa65bcf9a3d27f7601..859bc5a53532dc90adbd377b70ccb00c8febc0bd 100644
--- a/modules/core/www/frontpage_auth.php
+++ b/modules/core/www/frontpage_auth.php
@@ -32,7 +32,7 @@ $allLinks = [
 ];
 \SimpleSAML\Module::callHooks('frontpage', $allLinks);
 
-$t = new \SimpleSAML\XHTML\Template($config, 'core:frontpage_auth.tpl.php');
+$t = new \SimpleSAML\XHTML\Template($config, 'core:frontpage_auth.twig');
 $t->data['pageid'] = 'frontpage_auth';
 $t->data['isadmin'] = $isadmin;
 $t->data['loginurl'] = $loginurl;
diff --git a/modules/core/www/frontpage_config.php b/modules/core/www/frontpage_config.php
index 8243fae641bde77c9de318fea8e016d117a4672e..bfd2cf6ade9f378e334b04dd7fdb24df2802adbb 100644
--- a/modules/core/www/frontpage_config.php
+++ b/modules/core/www/frontpage_config.php
@@ -164,7 +164,7 @@ $funcmatrix[] = [
     'enabled' => $password_ok
 ];
 
-$t = new \SimpleSAML\XHTML\Template($config, 'core:frontpage_config.tpl.php');
+$t = new \SimpleSAML\XHTML\Template($config, 'core:frontpage_config.twig');
 $translator = $t->getTranslator();
 $t->data['pageid'] = 'frontpage_config';
 $t->data['header'] = $translator->t('{core:frontpage:page_title}');
diff --git a/modules/core/www/frontpage_federation.php b/modules/core/www/frontpage_federation.php
index 66e896841a2706ebcbd6290b938df93b8050f581..8ab6ac09271571843c94480123b4bf01a4d834d3 100644
--- a/modules/core/www/frontpage_federation.php
+++ b/modules/core/www/frontpage_federation.php
@@ -86,7 +86,7 @@ foreach ($metaentries['remote'] as $key => $value) {
     }
 }
 
-$t = new \SimpleSAML\XHTML\Template($config, 'core:frontpage_federation.tpl.php');
+$t = new \SimpleSAML\XHTML\Template($config, 'core:frontpage_federation.twig');
 $translator = $t->getTranslator();
 
 $language = $translator->getLanguage()->getLanguage();
diff --git a/modules/core/www/frontpage_welcome.php b/modules/core/www/frontpage_welcome.php
index 22dc2d9f3438085c57c7d9b3fffbf7ff35f0445d..9a662dafa68a966912b004a3dd11da32c250acc4 100644
--- a/modules/core/www/frontpage_welcome.php
+++ b/modules/core/www/frontpage_welcome.php
@@ -33,7 +33,7 @@ $links_welcome[] = [
 
 \SimpleSAML\Module::callHooks('frontpage', $allLinks);
 
-$t = new \SimpleSAML\XHTML\Template($config, 'core:frontpage_welcome.tpl.php');
+$t = new \SimpleSAML\XHTML\Template($config, 'core:frontpage_welcome.twig');
 $t->data['pageid'] = 'frontpage_welcome';
 $t->data['isadmin'] = $isadmin;
 $t->data['loginurl'] = $loginurl;
diff --git a/modules/core/www/idp/logout-iframe.php b/modules/core/www/idp/logout-iframe.php
index 442b26bd0904cf0600dabf76042874ac3dade64f..0145a9aa7cb607a434a85087e78f2f4764ce471f 100644
--- a/modules/core/www/idp/logout-iframe.php
+++ b/modules/core/www/idp/logout-iframe.php
@@ -122,9 +122,9 @@ foreach ($state['core:Logout-IFrame:Associations'] as $association) {
 
 $globalConfig = \SimpleSAML\Configuration::getInstance();
 if ($type === 'nojs') {
-    $t = new \SimpleSAML\XHTML\Template($globalConfig, 'core:logout-iframe-wrapper.tpl.php');
+    $t = new \SimpleSAML\XHTML\Template($globalConfig, 'core:logout-iframe-wrapper.twig');
 } else {
-    $t = new \SimpleSAML\XHTML\Template($globalConfig, 'core:logout-iframe.tpl.php');
+    $t = new \SimpleSAML\XHTML\Template($globalConfig, 'core:logout-iframe.twig');
 }
 
 /**
diff --git a/modules/core/www/loginuserpass.php b/modules/core/www/loginuserpass.php
index 27e4327167839bc7d84d3692052891fcfe9aef45..ec9faec0a64435e9f659df51ed912eb91887e9ba 100644
--- a/modules/core/www/loginuserpass.php
+++ b/modules/core/www/loginuserpass.php
@@ -99,7 +99,7 @@ if (!empty($_REQUEST['username']) || !empty($password)) {
 }
 
 $globalConfig = \SimpleSAML\Configuration::getInstance();
-$t = new \SimpleSAML\XHTML\Template($globalConfig, 'core:loginuserpass.tpl.php');
+$t = new \SimpleSAML\XHTML\Template($globalConfig, 'core:loginuserpass.twig');
 $t->data['stateparams'] = ['AuthState' => $authStateId];
 if (array_key_exists('forcedUsername', $state)) {
     $t->data['username'] = $state['forcedUsername'];
diff --git a/modules/core/www/loginuserpassorg.php b/modules/core/www/loginuserpassorg.php
index be63c72bb3e13436cd92f5d64101232c84ef18f6..2130fd4ac8cb3990c2199256e0d50c7af0134080 100644
--- a/modules/core/www/loginuserpassorg.php
+++ b/modules/core/www/loginuserpassorg.php
@@ -128,7 +128,7 @@ if ($organizations === null || !empty($organization)) {
 }
 
 $globalConfig = \SimpleSAML\Configuration::getInstance();
-$t = new \SimpleSAML\XHTML\Template($globalConfig, 'core:loginuserpass.tpl.php');
+$t = new \SimpleSAML\XHTML\Template($globalConfig, 'core:loginuserpass.twig');
 $t->data['stateparams'] = ['AuthState' => $authStateId];
 $t->data['username'] = $username;
 $t->data['forceUsername'] = false;
diff --git a/modules/core/www/no_cookie.php b/modules/core/www/no_cookie.php
index c2ff054fa94049cad6b74bbde314699105945ae0..f5dd285ed077d45a7f1f8cf16e5a318ff41a2c87 100644
--- a/modules/core/www/no_cookie.php
+++ b/modules/core/www/no_cookie.php
@@ -8,7 +8,7 @@ if (isset($_REQUEST['retryURL'])) {
 }
 
 $globalConfig = \SimpleSAML\Configuration::getInstance();
-$t = new \SimpleSAML\XHTML\Template($globalConfig, 'core:no_cookie.tpl.php');
+$t = new \SimpleSAML\XHTML\Template($globalConfig, 'core:no_cookie.twig');
 $translator = $t->getTranslator();
 
 /** @var string $header */
diff --git a/modules/core/www/short_sso_interval.php b/modules/core/www/short_sso_interval.php
index 2659471c1ea3a8f2e18f94d68038a2430a3e1d0e..2d1de11d86b4c1c5396728732b44e18970b79efd 100644
--- a/modules/core/www/short_sso_interval.php
+++ b/modules/core/www/short_sso_interval.php
@@ -23,7 +23,7 @@ if (array_key_exists('continue', $_REQUEST)) {
 }
 
 $globalConfig = \SimpleSAML\Configuration::getInstance();
-$t = new \SimpleSAML\XHTML\Template($globalConfig, 'core:short_sso_interval.tpl.php');
+$t = new \SimpleSAML\XHTML\Template($globalConfig, 'core:short_sso_interval.twig');
 $translator = $t->getTranslator();
 $t->data['target'] = \SimpleSAML\Module::getModuleURL('core/short_sso_interval.php');
 $t->data['params'] = ['StateId' => $id];
diff --git a/modules/core/www/show_metadata.php b/modules/core/www/show_metadata.php
index d9dd9ffdc455aa556cfc559ac07292fce0e969a6..6c9e444be8f090e8c49cb2a57a13695484c2ca75 100644
--- a/modules/core/www/show_metadata.php
+++ b/modules/core/www/show_metadata.php
@@ -26,7 +26,7 @@ $metadata = \SimpleSAML\Metadata\MetaDataStorageHandler::getMetadataHandler();
 
 $m = $metadata->getMetaData($_REQUEST['entityid'], $_REQUEST['set']);
 
-$t = new \SimpleSAML\XHTML\Template($config, 'core:show_metadata.tpl.php');
+$t = new \SimpleSAML\XHTML\Template($config, 'core:show_metadata.twig');
 $t->data['clipboard.js'] = true;
 $t->data['pageid'] = 'show_metadata';
 $t->data['header'] = 'SimpleSAMLphp Show Metadata';
diff --git a/modules/exampleauth/www/authpage.php b/modules/exampleauth/www/authpage.php
index b4b4b4458ee6dcec6cd1c9edb187efe0f30a9ec6..085b486c26d13614b5fe2cb077af52f6f650f8a9 100644
--- a/modules/exampleauth/www/authpage.php
+++ b/modules/exampleauth/www/authpage.php
@@ -80,7 +80,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
 
 // if we get this far, we need to show the login page to the user
 $config = \SimpleSAML\Configuration::getInstance();
-$t = new \SimpleSAML\XHTML\Template($config, 'exampleauth:authenticate.tpl.php');
+$t = new \SimpleSAML\XHTML\Template($config, 'exampleauth:authenticate.twig');
 $t->data['badUserPass'] = $badUserPass;
 $t->data['returnTo'] = $returnTo;
 $t->send();
diff --git a/modules/multiauth/www/selectsource.php b/modules/multiauth/www/selectsource.php
index 6d7e5d97d3edafc713d9e6835ad638bd88b8c883..f635521b65eef6a6e53f14ebf3afd84bdb025d88 100644
--- a/modules/multiauth/www/selectsource.php
+++ b/modules/multiauth/www/selectsource.php
@@ -51,7 +51,7 @@ if (array_key_exists('multiauth:preselect', $state)) {
 }
 
 $globalConfig = \SimpleSAML\Configuration::getInstance();
-$t = new \SimpleSAML\XHTML\Template($globalConfig, 'multiauth:selectsource.tpl.php');
+$t = new \SimpleSAML\XHTML\Template($globalConfig, 'multiauth:selectsource.twig');
 
 $defaultLanguage = $globalConfig->getString('language.default', 'en');
 $language = $t->getTranslator()->getLanguage()->getLanguage();
diff --git a/modules/saml/www/proxy/invalid_session.php b/modules/saml/www/proxy/invalid_session.php
index 3a3d3b88657bc8f973ee06edf4328466249f8dc9..ef0885887750d87dc9263a3d581e4407470ef9de 100644
--- a/modules/saml/www/proxy/invalid_session.php
+++ b/modules/saml/www/proxy/invalid_session.php
@@ -48,7 +48,7 @@ if (isset($_POST['continue'])) {
 }
 
 $cfg = \SimpleSAML\Configuration::getInstance();
-$template = new \SimpleSAML\XHTML\Template($cfg, 'saml:proxy/invalid_session.tpl.php');
+$template = new \SimpleSAML\XHTML\Template($cfg, 'saml:proxy/invalid_session.twig');
 $translator = $template->getTranslator();
 $template->data['AuthState'] = (string) $_REQUEST['AuthState'];
 
diff --git a/modules/saml/www/sp/metadata.php b/modules/saml/www/sp/metadata.php
index e32b1d34b2885f1ec94e8a8a574ed6800382ae4e..c2e58ee43f21fa35d55d448651444d768c682c1d 100644
--- a/modules/saml/www/sp/metadata.php
+++ b/modules/saml/www/sp/metadata.php
@@ -272,7 +272,7 @@ if (isset($metaArray20['attributes']) && is_array($metaArray20['attributes'])) {
 $xml = \SimpleSAML\Metadata\Signer::sign($xml, $spconfig->toArray(), 'SAML 2 SP');
 
 if (array_key_exists('output', $_REQUEST) && $_REQUEST['output'] == 'xhtml') {
-    $t = new \SimpleSAML\XHTML\Template($config, 'metadata.tpl.php', 'admin');
+    $t = new \SimpleSAML\XHTML\Template($config, 'metadata.twig', 'admin');
 
     $t->data['clipboard.js'] = true;
     $t->data['header'] = 'saml20-sp'; // TODO: Replace with headerString in 2.0
diff --git a/modules/saml/www/sp/wrong_authncontextclassref.php b/modules/saml/www/sp/wrong_authncontextclassref.php
index 5c81d73e5cdc29b732d1f2ba2831aa585219edd3..15c08cd9a4d96bbe681c33876bc2d99c7f209da2 100644
--- a/modules/saml/www/sp/wrong_authncontextclassref.php
+++ b/modules/saml/www/sp/wrong_authncontextclassref.php
@@ -1,5 +1,5 @@
 <?php
 
 $globalConfig = \SimpleSAML\Configuration::getInstance();
-$t = new \SimpleSAML\XHTML\Template($globalConfig, 'saml:sp/wrong_authncontextclassref.tpl.php');
+$t = new \SimpleSAML\XHTML\Template($globalConfig, 'saml:sp/wrong_authncontextclassref.twig');
 $t->send();