diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 3aa310b..98eea17 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -1708,6 +1708,129 @@ mail_refresh_folder(CamelFolder *folder, void (*done) (CamelFolder *folder, gpoi
 
 /* ******************************************************************************** */
 
+static gboolean
+folder_is_from_source_url (CamelFolder *folder, const gchar *source_url)
+{
+	CamelStore *store;
+	CamelService *service;
+	CamelURL *url;
+	gboolean res = FALSE;
+
+	g_return_val_if_fail (folder != NULL, FALSE);
+	g_return_val_if_fail (source_url != NULL, FALSE);
+
+	store = camel_folder_get_parent_store (folder);
+	g_return_val_if_fail (store != NULL, FALSE);
+
+	service = CAMEL_SERVICE (store);
+	g_return_val_if_fail (service != NULL, FALSE);
+	g_return_val_if_fail (service->provider != NULL, FALSE);
+	g_return_val_if_fail (service->provider->url_equal != NULL, FALSE);
+
+	url = camel_url_new (source_url, NULL);
+	g_return_val_if_fail (url != NULL, FALSE);
+
+	res = service->provider->url_equal (service->url, url);
+
+	camel_url_free (url);
+
+	return res;
+}
+
+/* This is because pop3 accounts are hidden under local Inbox, thus whenever an expunge
+   is done on a local trash or Inbox, then also all active pop3 accounts should be expunged. */
+static void
+expunge_pop3_stores (CamelFolder *expunging, CamelException *ex)
+{
+	GPtrArray *uids;
+	CamelFolder *folder;
+	EAccount *account;
+	EIterator *iter;
+	guint i;
+	GHashTable *expunging_uids = NULL;
+
+	uids = camel_folder_get_uids (expunging);
+	if (!uids)
+		return;
+
+	for (i = 0; i < uids->len; i++) {
+		CamelMessageInfo *info = camel_folder_get_message_info (expunging, uids->pdata[i]);
+
+		if (!info)
+			continue;
+ 
+		if ((camel_message_info_flags (info) & CAMEL_MESSAGE_DELETED) != 0) {
+			CamelMimeMessage *msg;
+			CamelException exx = CAMEL_EXCEPTION_INITIALISER;
+
+			/* because the UID in the local store doesn't match with the UID in the pop3 store */
+			msg = camel_folder_get_message (expunging, uids->pdata[i], &exx);
+			if (msg) {
+				const gchar *pop3_uid;
+
+				pop3_uid = camel_medium_get_header (CAMEL_MEDIUM (msg), "X-Evolution-POP3-UID");
+				if (pop3_uid) {
+					gchar *duped = g_strstrip (g_strdup (pop3_uid));
+
+					if (!expunging_uids)
+						expunging_uids = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+
+					g_hash_table_insert (expunging_uids, duped, g_strdup (camel_mime_message_get_source (msg)));
+				}
+
+				camel_object_unref (msg);
+			}
+
+			camel_exception_clear (&exx);
+		}
+
+		camel_folder_free_message_info (expunging, info);
+	}
+
+	camel_folder_free_uids (expunging, uids);
+	uids = NULL;
+
+	if (!expunging_uids)
+		return;
+
+	for (iter = e_list_get_iterator ((EList *)e_get_account_list ());
+	     e_iterator_is_valid (iter) && !camel_exception_is_set (ex);
+	     e_iterator_next (iter)) {
+		account = (EAccount *) e_iterator_get (iter);
+
+		if (account->enabled && account->source && account->source->url && g_str_has_prefix (account->source->url, "pop://")) {
+			gboolean any_found = FALSE;
+
+			folder = mail_tool_get_inbox (account->source->url, ex);
+			if (!folder || camel_exception_is_set (ex))
+				continue;
+
+			uids = camel_folder_get_uids (folder);
+			if (uids) {
+				for (i = 0; i < uids->len; i++) {
+					/* ensure the ID is from this account, as it's generated by evolution */
+					const gchar *source_url = g_hash_table_lookup (expunging_uids, uids->pdata[i]);
+					if (source_url && folder_is_from_source_url (folder, source_url)) {
+						any_found = TRUE;
+						camel_folder_delete_message (folder, uids->pdata[i]);
+					}
+				}
+				camel_folder_free_uids (folder, uids);
+			}
+
+			if (any_found)
+				camel_folder_sync (folder, TRUE, ex);
+
+			camel_object_unref (folder);
+		}
+	}
+
+	if (iter)
+		g_object_unref (iter);
+
+	g_hash_table_destroy (expunging_uids);
+}
+
 static gchar *
 expunge_folder_desc (struct _sync_folder_msg *m)
 {
@@ -1717,7 +1840,28 @@ expunge_folder_desc (struct _sync_folder_msg *m)
 static void
 expunge_folder_exec (struct _sync_folder_msg *m)
 {
-	camel_folder_expunge(m->folder, &m->base.ex);
+	gboolean is_local_inbox_or_trash = m->folder == e_mail_local_get_folder (E_MAIL_FOLDER_INBOX);
+
+	if (!is_local_inbox_or_trash && e_mail_local_get_store () == camel_folder_get_parent_store (m->folder)) {
+		const gchar *data_dir;
+		CamelFolder *trash;
+		gchar *uri;
+
+		data_dir = mail_session_get_data_dir ();
+		uri = g_strdup_printf ("mbox:%s/local", data_dir);
+		trash = mail_tool_get_trash (uri, TRUE, &m->base.ex);
+		g_free (uri);
+
+		is_local_inbox_or_trash = m->folder == trash;
+
+		camel_object_unref (trash);
+	}
+
+	/* do this before expunge, to know which messages will be expunged */
+	if (is_local_inbox_or_trash && !camel_exception_is_set (&m->base.ex))
+		expunge_pop3_stores (m->folder, &m->base.ex);
+
+	camel_folder_expunge (m->folder, &m->base.ex);
 }
 
 /* we just use the sync stuff where we can, since it would be the same */
@@ -1777,6 +1921,10 @@ empty_trash_exec (struct _empty_trash_msg *m)
 	}
 
 	if (trash) {
+		/* do this before expunge, to know which messages will be expunged */
+		if (!m->account && !camel_exception_is_set (&m->base.ex))
+			expunge_pop3_stores (trash, &m->base.ex);
+
 		camel_folder_expunge (trash, &m->base.ex);
 		camel_object_unref (trash);
 	}
