At the end of Eli haCohen’s life, the Ark of the Covenant was captured in battle by the P’lishtim, who held it for seven months. Initially they placed it in the temple of their idol. However, when they returned in the morning, the idol was lying on the ground before the Ark. The following morning the idol was not lying on the ground, but its head and limbs were broken off. They moved the Ark somewhere else, but wherever it was taken, the people were severely afflicted with hemorrhoids and other woes.
Upon realizing that G-d was punishing them for holding the His Ark, the P’lishtim resolved to return it. They took two nursing cows that had never carried a yoke, confined their suckling calves at home and hitched the cows to a new wagon. Then they placed the Holy Ark on the wagon and pointed the cows towards the Israeli border, reasoning that if the cows abandoned their young and carried the Ark home, this would be a sign that G-d wished for the Ark to be returned. Indeed, the cows proceeded directly to the town of Bais Shemesh.
The story of the return of the Ark by the P’lishtim to Bais Shemesh subtly contrasts the attitude of the P’lishtim towards it with that of the Israelites who received it, serving as a reproof to the latter for failing to show the proper respect. (A similar lack of respect is often visible in present-day places of "worship".)
The P’lishtim consult their priests and magician-diviners as to a fitting way to return the Ark that had created such havoc in their land (a terrible infestation of mice) and in their very innards (the hemorrhoids). (According to one Medrosh the mice jumped up into them and pulled out their innards, making this plague no less striking than those of Egypt.) The priests and magicians answered that the P’lishtim must SHOW that they understand that the plague was from G-d by offering GOLDEN MICE and GOLDEN HEMORRHOIDS. "Then you shall be healed, and HE WILL BE KNOWN TO YOU – why would He then not turn his hand away from you" (Shoftim 6,3).
Nevertheless, the P’lishtim did not quite believe in G-d's supreme power. They believed in a variety of divine powers and knew of the wrath of the G-ds, which they sought to appease, but they also believed in luck and chance. This was why they set up the test of the cow-drawn wagon to see if the plague might not have been chance. "And you will see, if it goes up by way of his boundary to Bais Shemesh, He did this great evil to us, but if not, we shall know that it was not His hand that plagued us, it was a CHANCE that occurred to us" (Shoftim 6,9).
The test was set up to be as difficult as possible. Two nursing cows were brought to draw the wagon laden with the heavy wooden gold-covered ark and its contents of stone together with the golden Cherubim together with the box of golden mice and golden hemorrhoids, while their suckling calves were held back in the house behind them. The last thing a nursing cow that has never had to work wants to do is to turn her back on her new-born calf and drag an exceedingly heavy wagon in the opposite direction.
So important was this KIDDUSH HASHEM, Sanctification of G-d's name, that – surprising as it may seem – the very BOX with the GOLDEN MICE and GOLDEN HEMORHOIDS offered by the P’lishtim was kept SIDE BY SIDE with the Ark of the Covenant in the Bais HaMikdash, throughout the period of the first Temple. They remained there until they were hidden together with the flask of Mahn made by Aharon in the Wilderness, the flask of the anointing oil, Aharon's staff and the flowering almond branch until they were hidden by King Yoshiah (Yoma 52b).
