4Those who were standing near Paul said, "You dare to insult God's high priest?"
5Paul replied, "Brothers, I did not realize that he was the high priest; for it is written: 'Do not speak evil about the ruler of your people."
6Then Paul, knowing that some of them were Sadducees and the others Pharisees, called out in the Sanhedrin, "My brothers, I am a Pharisee, the son of a Pharisee. I stand on trial because of my hope in the resurrection of the dead." 7When he said this, a dispute broke out between the Pharisees and the Sadducees, and the assembly was divided. 8(The Sadducees say that there is no resurrection, and that there are neither angels nor spirits, but the Pharisees acknowledge them all.)
Paul before the Sanhedrin
I referred to my commentary for this information.
v.2-5 Ananias was a profane, greedy and hot-tempered man. Paul's outburst came as a result of the illegal command that Ananias had given, he violated Jewish law by assuming that Paul was guilty without a trial and ordering his punishment. Paul did not recognize Ananias as the high priest, probably because Ananias's command broke the law he was pledged to represent.
v.6-8 The Sadducees and Pharisees were two groups of religious leaders, but with strikingly different beliefs. The Pharisees believed in a bodily resurrection, but the Sadducees did not. The Sadducees adhered only to Genesis through Deuteronomy, which contain no explicit teaching on the resurrection. Paul's words moved the debate away from himself and toward their festering controversy about the resurrection, which spit the Jewish council..
All this is an example that God will help us when we are under fire for our faith. Like Paul, we should always be ready to present our testimony. The Holy Spirit will give us power to speak boldly.