A county clerk in the US state of Kentucky who refuses to issue marriage licences to same-sex couples on religious grounds has been detained for contempt of court by a US federal judge.

Rowan county clerk Kim Davis was taken into custody by US marshals on Thursday in a case seen as a major test to a US Supreme Court law that has given homosexuals the right to marry.

Davis has denied licences to any couples, gay or straight, claiming that the June Supreme Court ruling granting same-sex couples the right to wed under the US Constitution contradicts her Christian beliefs.

Gay marriage triggers debate on polygamy unions

"You can't be separated from something that's in your heart and in your soul," Davis told the judge as she explained how the Supreme Court's ruling legalising gay marriage nationwide conflicted with the vows she made when she became a born-again Christian.

The judge said she left him with no alternative but to jail her, since fines alone would not serve to change her mind.

The judge also told all five of her deputy clerks that they were free to issue licences to all applicants and would also face fines or jail if they refused to comply. He gave them a chance to meet with lawyers before returning to his courtroom to reveal their decisions..

Hundreds of demonstrators, including supporters and opponents of Davis, gathered outside the courthouse, some chanting slogans and many holding signs.

Many celebrated the court's verdict by chanting and screaming "Love won! Love won!".

There was also substantial support for Davis. A small plane flew over the courthouse, carrying a banner that said: "Stand firm Kim".

Source: Agencies