What is the meaning of Matthew 10:17-20?

17 But beware of men: for they will deliver you up to the councils, and they will scourge you in their synagogues; 18 And ye shall be brought before governors and kings for my sake, for a testimony against them and the Gentiles. 19 But when they deliver you up, take no thought how or what ye shall speak: for it shall be given you in that same hour what ye shall speak. 20 For it is not ye that speak, but the Spirit of your Father which speaketh in you. (Matthew 10:17-20 KJV)

William Burkitt’s Commentary

Here our Saviour lets his apostles know that for their owning him, and preaching his gospel, they shall be brought before all sorts of magistrates, and in all kinds of courts: but he advises them, when they are brought before kings and princes, not to be anxiously thoughtful what they should say; for it should be given them in that hour what they should answer.

Learn hence, That though truth may be opposed, yet truth’s defenders should never be ashamed; and rather than they shall want a tongue to plead for it, God himself will prompt them by his Spirit, and suggest such truths to their minds as all their opposers should not be able to gainsay.

Yet, note, That Christ doth not here forbid all fore-thoughts what to say, but only distrustful thoughts; that they should not, like orators or advocates, strive to make studied pleas or rhetorical apologies for themselves, since the Spirit would be in their mouths, and give them immediate supplies.

Note also, That because Christ here promised his apostles and immediate assistance from the Holy Spirit, how vain the Anabaptists and Quakers are, who by virtue of this promise do now expect the same assistance in prayer and preaching: but they may as well pretend to cast out devils as the apostles did, by virtue of the same assistance which the apostles had; whereas these extraordinary gifts have long ceased.