If fancy presents images not moral or religious, the mind drives them away when they give it pain
 Samuel Johnson, The History of Rasselas, Prince of Abissinia (1759). copy citation

Context

““is so difficult of cure as that which is complicated with the dread of guilt; fancy and conscience then act interchangeably upon us, and so often shift their places, that the illusions of one are not distinguished from the dictates of the other. If fancy presents images not moral or religious, the mind drives them away when they give it pain; but when melancholy notions take the form of duty, they lay hold on the faculties without opposition, because we are afraid to exclude or banish them. For this reason the superstitious are often melancholy, and the melancholy almost always superstitious.” source