Minecraft: Why did a villager brought to deserted village run away

minecraft-java-edition

Near my base on a Minecraft java edition 1.16.4 realm is a deserted village which I want to repopulate.

I brought a villager from another village there but he instantly runs away. The village where I took the villager from is away around 300 blocks south and 200 blocks west.
There are at least 4 beds and several occupation blocks in the village I want to repopulate.

The villager already had an mason occupation, is that the reason he ran away?
How can I make sure villagers stay in the destination village?

Best Answer

I found out that it was because I let the villager out of the minecart at too great a distance of a door. For the second villager I simply put a door right next to the minecart, before releasing the villager, then it worked.