Does God have the power to do anything contrary to what He must do?

No, God can’t do anything contrary than what He must do. What He must do is consistent with what He is, such as good, holy, merciful, etc. However, He is not under the influence or power of something greater than Himself which would force Him to do something good as if there was a standard of goodness that God must obey. Instead, He does what is consistent with His goodness and holiness, which is what He is by nature. Therefore, He cannot lie. He cannot break His word. He cannot make mistakes.

But then some might say that God is not all-powerful and that He has limits. Christianity never says that God is all-powerful in the sense of being able to contradict Himself or do things that are impossible, such as make a round square or destroy Himself and make Himself over again. Instead, God is consistent in Himself, perfect in His ways, and He can only do what He can do and that with perfect power and wisdom.