Once there lived a metalworker, a locksmith, who was unjustly accused of crimes and was sentenced to a deep, dark prison. After he had been there awhile, his wife who loved him very much went to the King and beseeched him that she might at least give him a prayer rug so he could observe his five prostrations every day.
The King considered that a lawful request, so he let the woman bring her husband a prayer rug. The prisoner was thankful to get the rug from his wife, and every day he faithfully did his prostrations on the rug. Much later, the man escaped from prison, and when people asked him how he got out, he explained that after years of doing his prostrations and praying for deliverance from the prison, he be an to see what was right in front of his nose.
One day he suddenly saw that his wife had woven into the prayer rug the pattern of the lock that imprisoned him. Once he realized this and understood that all the information he needed to escape was already in his possession, he began to make friends with his guards. He also persuaded the guards that they all would have a better life if they cooperated and escaped the prison together.
They agreed since, although they were guards, they realized that they were in prison, too. They also wished to escape, but they had no means to do so. So the locksmith and his guards decided on the following plan: they would bring him pieces of metal, and he would fashion useful items from them to sell in the marketplace. Together they would amass resources for their escape, and from the strongest piece of metal they could acquire, the locksmith would fashion a key.
One night, when everything had been prepared, the locksmith and his guards unlocked the prison and walked out into the cool night where his beloved wife was waiting for him. He left the prayer rug behind so that any other prisoner who was clever enough to read the pattern of the rug could also make his escape. Thus, the locksmith was reunited with his loving wife, his former guards became his friends, and everyone lived in harmony.
This Sufi spiritual story is from Thinkers of the East by Idries Shah. His book is a delightful collection of short spiritual stories.