In 1562, King Phillip II of Spain was desperate. His son, Don Carlos, had hit his head and was dying despite everything his physicians could do.
Phillip offered God a deal: If God would heal his son, the king would give God a miracle in return.
Don Carlos, who had been on the point of death, recovered. When he was better, he told a story about being approached by a cross-wielding monk who had healed him.
It turned out that there was an industrial-strength holy relic there in Madrid, the corpse of Diego de Alcalá, a local saintly type who now has a certain large town in Southern California named after him. In desperation – the accounts vary greatly – someone had the mummified cleric put into bed with the dying prince.
This left Phillip II with a serious problem. He had cut a deal with God. God had held up his end. He owed the Deity one miracle.
He hit on the solution of having a local clockmaker fashion a mechanical monk that moves around and prays.
This story is courtesy of NPR. There is video of the monk.