Abu Hasan Al-Ziyadi was so hugely indebted that he was shunned by everybody. One day, Khorasan met him and gave him ten thousand dirhams for safekeeping as he was going on a pilgrimage.
He also told Hasan if he did not return along with the group, he could keep the money, otherwise should return it back. As he left for the pilgrimage, Abu cleared all his debt and enjoyed the rest of the money.
Khorasan returned from his pilgrimage hearing his father’s death the very next day itself. Abu lied to him that the money was kept in a different place and he could have it the next day. Not knowing what to do, Abu took his mule and went on aimlessly.
Some people took him to Al-Maamun who told him that the Allah came into his dream thrice and said to help Abu. Abu was given enough money to repay Khorasan. When Khorasan heard the whole story, he refused to take the money and made Abu the Qazi of Al-Madina, the Holy City.