It is from Guide for the Perplexed (Moreh Nevuchim) Book III; chapter 15. I am using the Friedlander translation of 1904 (which I know is not very good, but it is available online for free - feel free to check the original Arabic if you are able, or the excellent Hebrew translation by Schwartz)
THAT which is impossible has a permanent and constant property, which is not the result of some agent, and cannot in any way change, and consequently we do not ascribe to God the power of doing what is impossible. No thinking man denies the truth of this maxim; none ignore it, but such as have no idea of Logic. There is, however, a difference of opinion among philosophers with reference to the existence of any particular thing. Some of them consider its existence to be impossible, and hold that God cannot produce the thing in question, whilst others think that it is possible, and that God can create it if He pleases to do so. E.g., all philosophers consider that it is impossible for one substratum to have at the same moment two opposite properties, or for the elementary components of a thing, substance and accident, to interchange, so that the substance becomes accident, and the accident becomes substance, or for a material substance to be without accident. Likewise it is impossible that God should produce a being like Himself, or annihilate, corporify, or change Himself. The power of God is not assumed to extend to any of these impossibilities. But the existence of accidents independent of substance is possible according to one class of philosophers, the Mutazilah, whilst according to others it is impossible; it must, however, be added that those who admit the existence of an accident independent of substance, have not arrived at this conclusion by philosophical research alone: but it was mainly by the desire to defend certain religious principles, which speculation had greatly shaken, that they had recourse to this theory. In a similar manner the creation of corporeal things, otherwise than from a substance, is possible according to our view, whilst the philosophers say that it is impossible. Again, whilst philosophers say that it is impossible to produce a square with a diagonal equal to one of the sides, or a solid angle that includes four right angles, or similar things, it is thought possible by some persons who are ignorant of mathematics, and who only know the words of these propositions, but have no idea of that which is expressed by them. I wonder whether this gate of research is open, so that all may freely enter, and whilst one imagines a thing and considers it possible, another is at liberty to assert that such a thing is impossible by its very nature; or whether the gate is closed and guarded by certain rules, so that we are able to decide with certainty whether a thing is physically impossible. I should also like to know, in the latter case, whether imagination or reason has to examine and test objects as to their being possible or not; likewise how things imagined, and things conceived intellectually, are to be distinguished from each other. For it occurs that we consider a thing as physically possible, and then some one objects, or we ourselves fear that our opinion is only the result of imagination, and not that of reason. In such a case it would be desirable to ascertain whether there exists some faculty to distinguish between imagination and intellect, [and if so,] whether this faculty is different from both, or whether it is part of the intellect itself to distinguish between intellectual and imaginary objects. All this requires investigation, but it does not belong to the theme of this chapter.
We have thus shown that according to each one of the different theories there are things which are impossible, whose existence cannot be admitted, and whose creation is excluded from the power of God, and the assumption that God does not change their nature does not imply weakness in God, or a limit to His power. Consequently things impossible remain impossible, and do not depend on the action of an agent. It is now clear that a difference of opinion exists only as to the question to which of the two classes a thing belongs; whether to the class of the impossible, or to that of the possible. Note it.
Also, here is a Stanford Encyclopedia of Philosophy's entry on Omnipotence. Which is very interesting.