diff --git a/src/plugins/sib-mam-history.js b/src/plugins/sib-mam-history.js
new file mode 100644
index 0000000000000000000000000000000000000000..bffcc149dfbab10eef3c601aca1026bf6db2d490
--- /dev/null
+++ b/src/plugins/sib-mam-history.js
@@ -0,0 +1,48 @@
+/**
+ * Forces the loading of the real number of messages (or more)
+ * from the setting `archived_messages_page_size`.
+ */
+converse.plugins.add('sib-mam-history', {
+    dependencies: [
+        'converse-mam',
+    ],
+    initialize() {
+        const { api } = this._converse;
+        let counter = 0;
+
+        api.listen.on('MAMResult', async data => {
+
+            const max = +api.settings.get('archived_messages_page_size');
+            const messages = await Promise.all(data.messages);
+
+            // Increase counter with the messages that contains a body
+            counter += messages.filter(attrs => attrs.body).length;
+
+            // Stop if the max value is not specified
+            // Stop if there are less messages available than the page size
+            // Stop if the counter registers more messages than the max value
+            if (!max || messages.length < max || counter >= max) {
+                counter = 0;
+                return;
+            }
+
+            const is_groupchat = data.chatbox.get('type') === converse.CHATROOMS_TYPE;
+            const oldest_message = messages.pop();
+
+            if (oldest_message) {
+                const by_jid = is_groupchat ? data.chatbox.get('jid') : converse.bare_jid;
+                const stanza_id = oldest_message && oldest_message['stanza_id '.concat(by_jid)];
+
+                if (stanza_id) {
+                    await data.chatbox.fetchArchivedMessages({
+                        'before': stanza_id
+                    });
+                } else {
+                    await data.chatbox.fetchArchivedMessages({
+                        'end': oldest_message['time']
+                    });
+                }
+            }
+        })
+    }
+});
diff --git a/src/solid-xmpp-chat.js b/src/solid-xmpp-chat.js
index 5e14d12f9fae4b54b266c159856c475e980d9556..6be7190759de9134c45d421b9542e8b88ab7483a 100644
--- a/src/solid-xmpp-chat.js
+++ b/src/solid-xmpp-chat.js
@@ -1,6 +1,7 @@
 import './conversejs/converse.min.js';
 import './conversejs/emojis.js';
 import './plugins/converse-rai.js';
+import './plugins/sib-mam-history.js'
 import { Sib, store, StoreMixin } from 'https://cdn.skypack.dev/@startinblox/core@0.15';
 import ComponentPath from './path.js';
 
@@ -390,7 +391,7 @@ export const SolidXMPPChat = {
         'allow_non_roster_messaging': true,
         'allow_dragresize': false,
         'allow_logout': false,
-        'archived_messages_page_size': "30",
+        'archived_messages_page_size': 30,
         'auto_list_rooms': true,
         'auto_login': this.element.dataset.autoLogin === 'true',
         'auto_join_on_invite': true,
@@ -426,7 +427,17 @@ export const SolidXMPPChat = {
           fileupload: true, // Not working in current Converse
           toggle_occupants: false
         },
-        'whitelisted_plugins': ['rai', 'conversejs-sib-disconnected', 'conversejs-sib-connected', 'conversejs-sib-focused', 'conversejs-changechat', 'conversejs-rai', 'custom-hats', 'remove-notifications'],
+        'whitelisted_plugins': [
+          'rai',
+          'sib-mam-history',
+          'conversejs-sib-disconnected',
+          'conversejs-sib-connected',
+          'conversejs-sib-focused',
+          'conversejs-changechat',
+          'conversejs-rai',
+          'custom-hats',
+          'remove-notifications',
+        ],
       });
 
       converse_sib.loaded_deferred.resolve();