Fortunately for U.S. citizens, we have separation of church and state. Citizens cannot use religion as an excuse for breaking the law.
Magistrates have every right to believe anything they want. Whether or not they approve of gay marriage, they must obey the law and perform marriage ceremonies for all couples that meet the criteria for legal marriage. It doesn’t matter why they disapprove of gay marriage – sincerely held religious beliefs, prejudice or any other reason. It doesn’t matter. They must obey the law.
I grew up in the South and remember seeing signs that said “I reserve the right to refuse service to anyone.” Those signs were posted in restaurants, grocery stores, department stores and gas stations. They were not-so subtle attempts by white business owners to keep black people off their premises. It seems outrageous now, doesn’t it? History repeats itself, again.