diff --git a/dictionaries/errors.php b/dictionaries/errors.php
index aa468a98aeb4f4733951d7e19449d09ebe37f4d3..0d6763cc00617cbb260f8a3a9c784cb5b3293df7 100644
--- a/dictionaries/errors.php
+++ b/dictionaries/errors.php
@@ -1020,6 +1020,12 @@ $lang = array(
 		'sl' => 'Strani ni bilo mogoÄŤe najti. Razlog: %REASON%. Naveden URL strani je bil: %URL%',
 		'hu' => '%URL% oldal nem található, a következő ok miatt: %REASON% ',
 	),
+	'title_BADREQUEST' => array (
+		'en' => 'Bad request received',
+	),
+	'descr_BADREQUEST' => array (
+		'en' => 'There is an error in the request to this page. The reason was: %REASON%',
+	),
 
 );
 
diff --git a/lib/SimpleSAML/Error/BadRequest.php b/lib/SimpleSAML/Error/BadRequest.php
new file mode 100644
index 0000000000000000000000000000000000000000..f7dabdb54ba5a2ac875f4bb7b2cbfa8df9c9c932
--- /dev/null
+++ b/lib/SimpleSAML/Error/BadRequest.php
@@ -0,0 +1,56 @@
+<?php
+
+/**
+ * Exception which will show a 400 Bad Request error page.
+ *
+ * This exception can be thrown from within an module page handler. The user will then be
+ * shown a 400 Bad Request error page.
+ *
+ * @author Olav Morken, UNINETT AS.
+ * @package simpleSAMLphp
+ * @version $Id$
+ */
+class SimpleSAML_Error_BadRequest extends SimpleSAML_Error_Error {
+
+
+	/**
+	 * Reason why this request was invalid.
+	 */
+	private $reason;
+
+
+	/**
+	 * Create a new BadRequest error.
+	 *
+	 * @param string $reason  Description of why the request was unacceptable.
+	 */
+	public function __construct($reason) {
+		assert('is_string($reason)');
+
+		$this->reason = $reason;
+		parent::__construct(array('BADREQUEST', '%REASON%' => $this->reason));
+	}
+
+
+	/**
+	 * Retrieve the reason why the request was invalid.
+	 *
+	 * @return string  The reason why the request was invalid.
+	 */
+	public function getReason() {
+		return $this->reason;
+	}
+
+
+	/**
+	 * Set the HTTP return code for this error.
+	 *
+	 * This should be overridden by subclasses who want a different return code than 500 Internal Server Error.
+	 */
+	protected function setHTTPCode() {
+		header('HTTP/1.0 400 Bad Request');
+	}
+
+}
+
+?>
\ No newline at end of file