In England, at the time of our founding, there were courts of law (the king's courts, which were secular and handled only secular matters) and courts of equity (the church's courts, that handled supposedly religious matters--marriage, divorce, probate, succession, and crimes against God or the church). We inherited this system, and despite our preference for separation of church and state, we still divide courts into courts of law (which handle matters that were traditionally handled by the king's courts) and courts of equity (which handle everything else). Any court of equity has "broad equitable power" to fashion a remedy (a legal order) that is "equitable" (i.e. fair), including making people go to church; making people attend A.A. meetings; ordering the recount every single ballot in Florida, or all the ballots in a few, select counties in Florida; making people wear embarrassing signs while standing out in front of the court house; you name it.
Personally, I get a little concerned when judges sitting in courts of law do these sorts of things. Traditionally, judges in courts of law could not do this, but judges in courts of equity can order just about anything that they think is fair.
Please note that the states' adoption of the English common law predates the Constitution of the United States, and all of the states, except Louisiana, which still operates under Code Napoleon, embrace and enforce English common law to this day--except to the extent that the common law has been "abrogated," i.e. changed, by statute or later case law. The Constitution of the United States did not, nor was it intended to, abrogate English common law.
-Laelth