The following quote is from Greg L. Bahnsen's, Theonomy in Christian Ethics:

The fact that Christians are commanded to obey the civil magistrate is another indication that human government is obligated to follow God’s holy law. Scripture clearly teaches that God’s people must obey and respect civil magistrates. And yet in the book of Revelation men are indicted and held culpable for following the dictates of the “beast,” that is, sinful Rome and its emperor. Moreover, those who followed the beast are contrasted with those who, instead, kept the law of God (Rev. 14:9-12). Rulers are consequently expected to follow the law of God so that Christians can obey them—or else those who are punished for obeying sinful Rome according to Revelation 14 would be exonerated by Romans 13! The way to reconcile Romans 13:4, where the state is spoken of as in the service of God, and Revelation 13:2, where the state is said to be in the service of Satan, is by viewing the former as the norm for government and the latter as indictment for deviation from that norm. Outside of that one must either forfeit the unity of Scripture or appeal to principles (e.g., Rom. 8:28) to explain Romans 13 which that passage itself gives no hint of utilizing as necessary for understanding its message. Thus the civil magistrate ought to promote obedience to God’s law (the good) and to punish with God’s wrath (i.e., according to the just penal sanctions for society) those who publicly perform evil deeds (violations of God’s laws). Toward this end believers are exhorted to pray for all kings and authorities: in order that they might lead peaceful lives in all godliness and holiness (1 Tim. 2:1-3).  The tranquility which the magistrate should establish and protect in society must be characterized by justice and civic righteousness, for his reign should enable Christians to live in peace (which does not mean, in this passage, that believers have “personal” peace while nevertheless under public persecution) and should provide for, and promote, an environment characterized by justice and righteousness (which, as in the case of tranquility, does not simply mean that believers have personal or private godliness in the midst of complete social unrighteousness and public injustice). The peace which the believer wants to have, and also the godliness which the believer wants to express, should be made possible by the civil magistrate’s proper administration of government; toward that end Christians are told to pray.