diff --git a/config/vufind/config.ini b/config/vufind/config.ini
index b69cf8ad8e0c23f7d119594b7b21c96cbdde047c..ccdee1acd707d356d483d9db02fc4d685691ddb5 100644
--- a/config/vufind/config.ini
+++ b/config/vufind/config.ini
@@ -1186,6 +1186,10 @@ url             = https://www.myendnoteweb.com/EndNoteWeb.html
 ; SearchApiRecordFields.yaml) are returned when metadata prefix
 ; "oai_vufind_json" is used.
 ;
+; record_format_filters allows mapping from requested OAI metadataPrefix to query
+; filters. They can be used e.g. to limit results to records that can be returned in
+; the requested format.
+;
 ;[OAI]
 ;identifier       = myuniversity.edu
 ;repository_name  = "MyUniversity Catalog"
@@ -1195,6 +1199,7 @@ url             = https://www.myendnoteweb.com/EndNoteWeb.html
 ;set_query['eod_ebooks'] = "format:eBook"
 ;default_query = "institution:kfu"
 ;vufind_api_format_fields = "id,authors,cleanIsbn,cleanIssn,formats,title"
+;record_format_filters[marc21] = "record_format:marc"
 
 ; Proxy Server is Optional.
 [Proxy]
diff --git a/module/VuFind/src/VuFind/OAI/Server.php b/module/VuFind/src/VuFind/OAI/Server.php
index e84dac9bd600ca1acc03a8d0694cbf8cb40585e4..5d4c8ac18fac16e809a96017b36f5f1cac293787 100644
--- a/module/VuFind/src/VuFind/OAI/Server.php
+++ b/module/VuFind/src/VuFind/OAI/Server.php
@@ -5,7 +5,7 @@
  * PHP version 7
  *
  * Copyright (C) Villanova University 2010.
- * Copyright (C) The National Library of Finland 2018.
+ * Copyright (C) The National Library of Finland 2018-2019.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2,
@@ -196,6 +196,13 @@ class Server
      */
     protected $vufindApiFields = [];
 
+    /**
+     * Filter queries specific to the requested record format
+     *
+     * @var array
+     */
+    protected $recordFormatFilters = [];
+
     /**
      * Constructor
      *
@@ -643,6 +650,12 @@ class Server
                 ',', $config->OAI->vufind_api_format_fields ?? ''
             )
         );
+
+        // Initialize filters specific to requested metadataPrefix:
+        if (isset($config->OAI->record_format_filters)) {
+            $this->recordFormatFilters
+                = $config->OAI->record_format_filters->toArray();
+        }
     }
 
     /**
@@ -741,6 +754,7 @@ class Server
         // Figure out how many non-deleted records we need to display:
         $recordLimit = ($params['cursor'] + $this->pageSize) - $currentCursor;
         $cursorMark = $params['cursorMark'] ?? '';
+        $format = $params['metadataPrefix'];
 
         // Get non-deleted records from the Solr index:
         $set = $params['set'] ?? '';
@@ -749,10 +763,10 @@ class Server
             $until,
             $cursorMark,
             $recordLimit,
+            $format,
             $set
         );
         $nonDeletedCount = $result->getResultTotal();
-        $format = $params['metadataPrefix'];
         foreach ($result->getResults() as $doc) {
             $this->attachNonDeleted($xml, $doc, $format, $headersOnly, $set);
             $currentCursor++;
@@ -884,12 +898,13 @@ class Server
      * @param int    $until      End date.
      * @param string $cursorMark cursorMark for the position in the full result list.
      * @param int    $limit      Max number of full records to return.
+     * @param string $format     Requested record format
      * @param string $set        Set to limit to (empty string for none).
      *
      * @return \VuFind\Search\Base\Results Search result object.
      */
     protected function listRecordsGetNonDeleted($from, $until, $cursorMark, $limit,
-        $set = ''
+        $format, $set = ''
     ) {
         // Set up search parameters:
         $results = $this->resultsManager->get($this->searchClassId);
@@ -922,6 +937,10 @@ class Server
             $params->addFilter('(' . $this->defaultQuery . ')');
         }
 
+        if (!empty($this->recordFormatFilters[$format])) {
+            $params->addFilter($this->recordFormatFilters[$format]);
+        }
+
         // Perform a Solr search:
         $results->overrideStartRecord(1);
         $results->setCursorMark($cursorMark);