Galileo was summoned to Rome on a charge of heresy. Thomas Aquinas defined heresy in the 1300's as "a species of infidelity in men who, having professed the faith of Christ, corrupt its dogmas".
Had Galileo not been a friend of the pope, things might have gone entirely different for him. The Inquisition could have put him to the question, and tortured him; instead, he ended up in what amounted to house arrest while the trial went on.
I've read in other, non-scholarly works that Galileo alienated most of the scientists of his age. I have not found any verification of that in the record; it would explain why his technical thesis failed to be an adequate defense. He had been forbidden to hold with the Copernican theory in 1616, yet in 1633 wrote a series of Dialogues upholding it. His defense, of course, was that he was only setting the theory up as a "straw man", for argument's sake only.
In 1633 Galileo was convicted of heresy, and was sentenced to reciting the seven penitential psalms once a week for 3 years.