First, go to the source. We have the documents from Galileo trials, so first, read what was actually said. http://www.tc.umn.edu/~allch001/galileo/library/1616docs.htm Here is the most relevant part:
Proposition to be assessed:
(1) The sun is the center of the world and completely
devoid of local motion.
Assessement: All said that this proposition is foolish
and absurd in philosophy, and formally heretical since it
explicitly contradicts many places the sense of Holy
Scripture, according to the literal meaning of the words
and according to the common interpretation and
understanding of the Holy Fathers and the doctors of
theology.
(2) The earth is not the center of the world, nor
motionless, but it moves as a whole and also with diurnal
motion.
Assessment: All said that this proposition receives the
same judgement in philosophy and that in regard to
theological truth it is at least errouneous in faith.
Here, "philosophy" more or less means science. So, yes, Galileo was criticized on scientific grounds, which is totally fine as indeed, there were some problems with his theory (like the lack of movement of stars).But Galileo was called an heretic because he contradicted the literal meaning of the bible. "formally heretical since it explicitly contradicts many places the sense of Holy Scripture, according to the literal meaning of the words and according to the common interpretation and understanding of the Holy Fathers and the doctors of theology" : this is your regular creationist saying that the bible has to be interpreted literally and that you are a heretic if you don't. Problem: said creationist can throw you in jail if you don't abide to his worldview.
That's why from this time (from a bit earlier actually) universities found it primordial to gain independence from the clergy and that science and religion diverged from each other.
Is this religious assessment coherent with others? Of course not! Religion is not much about coherency. Copernicus heliocentrism was well accepted by the church as he was less confrontational, richer and more religious.
Did Galileo act like an asshole? Maybe, though church did need some trolling at this time. Was his condemnation political? Most certainly! But the salient point is that the motivation may have been political, the justification was religious. And that was unacceptable to scientists that you could justify dogmatism and rewrite science books for political motives. The refusal of this is what gave us modern science.