What does Acts 4:19-20 mean?

19 But Peter and John answered and said unto them, Whether it be right in the sight of God to hearken unto you more than unto God, judge ye. 20 For we cannot but speak the things which we have seen and heard. (Acts 4:19-20 KJV)

William Burkitt’s Commentary

Observe here the prudence and integrity of the apostles in referring it back to the judgment of their very adversaries, whether it was reasonable to obey their command, when they charged them to preach no more in the name of the Lord Jesus.

As if the apostles had said, “We have received a command from God to preach, Go teach all nations, Matthew 28:19 and we have received a command from you not to preach: now we leave it with you whether it be fittest and most reasonable to obey God or you?” It is a strong way of conviction to refer a matter to their judgment and conscience, against whom we make opposition.

Learn, That when the commands of God’s vicegerents run counter to the commands of God himself, God is to be obeyed, and not man.