"Peter and the other apostles replied: 'We must obey God rather than men!'" NIV translation
When brought before the rulers of Jerusalem, the apostles had to decide whether to do what they said and stop teaching about Jesus or ignore them and do what God had told them to do. The above verse is the beginning of their reply. There are many times when we have the same choice to make in our daily lives. We must remember that God's word comes first because it is perfect. Other authorities can make laws but they are not perfect. When the two disagree, we must give the same reply as the apostles did here.
"'The God of our fathers raised Jesus from the dead- whom you had killed by hanging him on a tree. God exalted him to his own right hand as Prince and Savior that he might give repentance and forgiveness of sins to Israel. We are witnesses of these things, and so is the Holy Spirit, whom God has given to those who obey him.'" NIV translation
The apostles are giving the Sanhedrin an explanation of their actions. It was not normal for the people to defy an order from the Sanhedrin but the apostles had. Their explanation is pretty simple in that they explain that God sent Jesus for the payment of our sins and, because of that, we are his. They go on to explain that the Holy Spirit is given to those who obey God.
"When they heard this, they were furious and wanted to put them to death. But a Pharisee named Gamaliel, a teacher of the law, who was honored by all the people, stood up in the Sanhedrin and ordered that the men be put outside for a little while," NIV translation
Now, the Sanhedrin wants to sentence the apostles to death but Gamaliel, a Pharisee intervenes. This same Gamaliel is the one who taught Saul (Paul) before he became an apostle.
"Then he addressed them: 'Men of Israel, consider carefully what you intend to do to these men. Some time ago Theudas appeared, claiming to be somebody, and about four hundred men rallied to him. He was killed, all his followers were dispersed, and it all came to nothing. After him, Judas the Galilean appeared in the days of the census and led a band of people in revolt. He too was killed, and all his followers were scattered. Therefore, in the present case I advise you: Leave these men alone! Let them go! For if their purpose or activity is of human origin, it will fail. But if it is from God, you will not be able to stop these men; you will only find yourselves fighting against God.'" NIV translation
Gamaliel is speaking to the Sanhedrin in this passage. This same Gamaliel was the one that taught religion to Saul (Paul). Now, he is trying to get the Sanhedrin to understand that if the apostles are not from God they will fail. If they are from God, then His will be done. We too can have this assurance from God. If we are doing His will, who can stop us?