diff --git a/lib/SimpleSAML/XHTML/Template.php b/lib/SimpleSAML/XHTML/Template.php
index f8332794f66dd8ebd5e11fbe3cc1834729d51aeb..65ff741621cdb7561f682e72ce10a8f128e6ea72 100644
--- a/lib/SimpleSAML/XHTML/Template.php
+++ b/lib/SimpleSAML/XHTML/Template.php
@@ -303,6 +303,7 @@ class SimpleSAML_XHTML_Template
      */
     private function twigDefaultContext()
     {
+        $this->data['languageParameterName'] = $this->configuration->getString('language.parameter.name', 'language');
         $this->data['localeBackend'] = $this->configuration->getString('language.i18n.backend', 'SimpleSAMLphp');
         $this->data['currentLanguage'] = $this->translator->getLanguage()->getLanguage();
         // show language bar by default
@@ -336,6 +337,9 @@ class SimpleSAML_XHTML_Template
 
         // add query parameters, in case we need them in the template
         $this->data['queryParams'] = $_GET;
+        if (isset($this->data['queryParams'][$this->data['languageParameterName']])) {
+            unset($this->data['queryParams'][$this->data['languageParameterName']]);
+        }
     }