Then the Philistines took the ark of God and brought it from Ebenezer to Ashdod.
When the Philistines took the ark of God, they brought it into the temple of Dagon and set it by Dagon.
References for 1 Samuel 5:2
And when the people of Ashdod arose early in the morning, there was Dagon, fallen on its face to the earth before the ark of the Lord. So they took Dagon and set it in its place again.
And when they arose early the next morning, there was Dagon, fallen on its face to the ground before the ark of the Lord. The head of Dagon and both the palms of its hands were broken off on the threshold; only Dagon's torso was left of it.
References for 1 Samuel 5:4
Therefore neither the priests of Dagon nor any who come into Dagon's house tread on the threshold of Dagon in Ashdod to this day.
But the hand of the Lord was heavy on the people of Ashdod, and He ravaged them and struck them with tumors, both Ashdod and its territory.
References for 1 Samuel 5:6
And when the men of Ashdod saw how it was, they said, "The ark of the God of Israel must not remain with us, for His hand is harsh toward us and Dagon our god."
Therefore they sent and gathered to themselves all the lords of the Philistines, and said, "What shall we do with the ark of the God of Israel?" And they answered, "Let the ark of the God of Israel be carried away to Gath." So they carried the ark of the God of Israel away.
So it was, after they had carried it away, that the hand of the Lord was against the city with a very great destruction; and He struck the men of the city, both small and great, and tumors broke out on them.
Therefore they sent the ark of God to Ekron. So it was, as the ark of God came to Ekron, that the Ekronites cried out, saying, "They have brought the ark of the God of Israel to us, to kill us and our people!"
So they sent and gathered together all the lords of the Philistines, and said, "Send away the ark of the God of Israel, and let it go back to its own place, so that it does not kill us and our people." For there was a deadly destruction throughout all the city; the hand of God was very heavy there.
And the men who did not die were stricken with the tumors, and the cry of the city went up to heaven.