diff --git a/lib/SimpleSAML/Configuration.php b/lib/SimpleSAML/Configuration.php
index 88faf027663a98d817bc67675bf52bc5279ae2d6..85d6975033c43f45bc55f27ffa47509dab7cec90 100644
--- a/lib/SimpleSAML/Configuration.php
+++ b/lib/SimpleSAML/Configuration.php
@@ -346,7 +346,7 @@ class SimpleSAML_Configuration {
 		
 		if (preg_match('/^\*(.*)$/D', $baseURL, $matches)) {
 			/* deprecated behaviour, will be removed in the future */
-			return SimpleSAML_Utilities::getFirstPathElement(false) . $matches[1];
+			return \SimpleSAML\Utils\HTTP::getFirstPathElement(false) . $matches[1];
 		}
 
 		if (preg_match('#^https?://[^/]*/(.*)$#', $baseURL, $matches)) {
diff --git a/lib/SimpleSAML/Utilities.php b/lib/SimpleSAML/Utilities.php
index 655fcdb17d7a8669c62acf8078be4803aa41c094..df9e6c163c0f009da7c657ef8a21dd222adc18f9 100644
--- a/lib/SimpleSAML/Utilities.php
+++ b/lib/SimpleSAML/Utilities.php
@@ -92,18 +92,15 @@ class SimpleSAML_Utilities {
 	public static function getSelfHostWithPath() {
 		return \SimpleSAML\Utils\HTTP::getSelfHostWithPath();
 	}
-	
+
+
 	/**
-	 * Will return foo
+	 * @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\HTTP::getFirstPathElement() instead.
 	 */
 	public static function getFirstPathElement($trailingslash = true) {
-	
-		if (preg_match('|^/(.*?)/|', $_SERVER['SCRIPT_NAME'], $matches)) {
-			return ($trailingslash ? '/' : '') . $matches[1];
-		}
-		return '';
+		return \SimpleSAML\Utils\HTTP::getFirstPathElement($trailingslash);
 	}
-	
+
 
 	public static function selfURL() {
 
diff --git a/lib/SimpleSAML/Utils/HTTP.php b/lib/SimpleSAML/Utils/HTTP.php
index aecd23be39dc5beebeac00a42a2839af5d3e7d88..1a170fccf2ecbb3593856d79d5c49b1c28506089 100644
--- a/lib/SimpleSAML/Utils/HTTP.php
+++ b/lib/SimpleSAML/Utils/HTTP.php
@@ -316,6 +316,24 @@ class HTTP
     }
 
 
+    /**
+     * Retrieve the first element of the URL path.
+     *
+     * @param boolean $trailingslash Whether to add a trailing slash to the element or not. Defaults to true.
+     *
+     * @return string The first element of the URL path, with an optional, trailing slash.
+     *
+     * @author Andreas Solberg, UNINETT AS <andreas.solberg@uninett.no>
+     */
+    public static function getFirstPathElement($trailingslash = true)
+    {
+        if (preg_match('|^/(.*?)/|', $_SERVER['SCRIPT_NAME'], $matches)) {
+            return ($trailingslash ? '/' : '').$matches[1];
+        }
+        return '';
+    }
+
+
     /**
      * Retrieve our own host.
      *
diff --git a/www/admin/hostnames.php b/www/admin/hostnames.php
index 04c9a06e8d3d74f21634ecc3e0f98c45f024f718..6839055ccaa9b43f9d124a064e100f55432abd7e 100644
--- a/www/admin/hostnames.php
+++ b/www/admin/hostnames.php
@@ -21,7 +21,7 @@ $attributes['Utilities_getSelfHost()'] = array(\SimpleSAML\Utils\HTTP::getSelfHo
 $attributes['Utilities_selfURLhost()'] = array(SimpleSAML_Utilities::selfURLhost());
 $attributes['Utilities_selfURLNoQuery()'] = array(SimpleSAML_Utilities::selfURLNoQuery());
 $attributes['Utilities_getSelfHostWithPath()'] = array(\SimpleSAML\Utils\HTTP::getSelfHostWithPath());
-$attributes['Utilities_getFirstPathElement()'] = array(SimpleSAML_Utilities::getFirstPathElement());
+$attributes['Utilities_getFirstPathElement()'] = array(\SimpleSAML\Utils\HTTP::getFirstPathElement());
 $attributes['Utilities_selfURL()'] = array(SimpleSAML_Utilities::selfURL());
 
 $et = new SimpleSAML_XHTML_Template($config, 'hostnames.php');