"... I was not at all daunted but rather glad, and saw evidently that the Lord had heard me; for before I went down to the justice, I begged of God that if I might do more good by being at liberty than in prison, that then I might be set at liberty; but if not, His will be done; for I was not altogether without hopes but that my imprisonment might be an awakening to the saints in the country, therefore I could not tell well which to choose; only I, in that manner, did commit the thing to God. And verily, at my return, I did meet my God sweetly in the prison again, comforting of me and satisfying of me that it was His will and mind that I should be there.
When I came back again to prison, as I was musing at the slender answer of the justice, this word dropt in upon my heart with some life, FOR HE KNEW THAT FOR ENVY THEY HAD DELIVERED HIM.
Thus have I, in short, declared the manner and occasion of my being in prison; where I lie waiting the good will of God, to do with me as He pleaseth; knowing that not one hair of my head can fall to the ground without the will of my Father, which is in heaven. Let the rage and malice of men be never so great, they can do no more, nor go any further, than God permits them; but when they have done their worst, We know all things shall work together for good to them that love God.
From, A Relation of My Imprisonment in the Month of November 1660, by John Bunyan (emphasis mine). You can read the entire booklet online here.