Thank you popowich for the answere. That works fine for mail that is in the inbox, but POP3 has no notion of maildirs so they can't be downloaded.
What I am doing at the moment is I created a folder called archives, locally on my computer, and configrued the archive feature of thunderbird to store archived mail in that folder. Now I select the emails from the IMAP account, right-click and choose archive. Thunderbird will copy them to the local archives folder and delete them from the remote server. But this is still a manual procedure. It would be cool if thunderbird had a feature where I don't have to manually click on archive. The software would automatically archive any mail older than X days (X configurable).