Every country is different, and US law varies by state. Here's a good page where you can get the actual wording of the law for religious weddings. They don't address justices of the peace or any other authorized officials, unfortunately.
US law, by state:
http://www.universalministries.com/genmarlaws.cfm
International law, by country:
http://www.universalministries.com/genmarlaws2.cfm
For example, in Mississippi, where I currently reside:
"Any ordained minister of the gospel who is in good standing with his or her church may perform marriages. Ministers must send a certificate of marriage to the clerk who issued the marriage license within three months after the marriage. For questions see the clerk of the circuit court."