Image copyright Getty Images Image caption Lawyer Mathew Staver (centre, seen here in 2006) is representing Kentucky clerk Kim Davis

Kim Davis, the small town county clerk who has been jailed for refusing to issue marriage licences to gay couples, has made headlines this week for defying not only two federal judges but the US Supreme Court as well. But who exactly are her lawyers?

It's an organisation that has a long-track record of representing anti-gay rights case in America: the Liberty Counsel.

It has been labelled a hate group by the Southern Poverty Law Center but it is a group that anti-gay rights activists are increasingly turning to to represent their views.

'Precedent-setting'

Founded by lawyer Mathew D Staver and his wife in 1989, the Liberty Counsel calls itself "an international non-profit litigation, education, and policy organisation dedicated to advancing religious freedom, the sanctity of life".

Mr Staver, a former minister, has spent over 15 years fighting the pro-gay marriage movement in courtrooms across in the US. In 2004, his organisation was involved in 15 of the 17 gay-marriage related cases taking place at the time, according to the Orlando Weekly.

Image copyright Reuters Image caption County clerk Kim Davis said issuing gay marriage licences was against her Christian faith

So it comes as no surprise the Florida-based Liberty Counsel has been providing Kim Davis with free counsel since June, when she first made headlines for defying a Supreme Court ruling that legalised gay marriage.

She has repeatedly refused to give out licences to same-sex couples, arguing it went against her religious beliefs as a born-again Christian.

And the Liberty Counsel has been giving her legal advice free of charge, Harry Mihet, vice president of legal affairs and chief litigation counsel, tells the BBC.

The counsel has taken on "a number of precedent-setting cases that have worked to protect first amendment rights of religious freedom for Americans, in areas of sanctity of life, free speech particularly in public squares and in areas of protecting national traditional beliefs," he explains.

It is also closely affiliated with Liberty University, an evangelical university based in Virginia, where Texas senator Ted Cruz announced he was running for the Republican presidential race in March. Mr Cruz is one of several Republican presidential candidates who has spoken out in support of Kim Davis.

"Today, for the first time ever, the government arrested a Christian woman for living according to her faith," the senator declared.

From gay rights to Harry Potter

Some of its notable cases included a long-running child custody dispute between a lesbian couple who had separated.

Mr Staver represented Lisa Miller, a former lesbian who, after becoming an evangelical Christian, "renounced homosexuality" and asked courts in Virginia and Vermont to deny her former lover, Janet Jenkins, visitation rights to her child in 2008.

Ms Miller later fled the US with her daughter after the court ordered her to surrender custody to Ms Jenkins.

Image copyright AP Image caption Kim Davis's jailing meant Rowan county court could issue its first gay marriage licences this week

But the counsel has been successful in other areas, winning cases that allow Bible study groups to meet in schools after hours, as well as defending homeowners who were forced to remove religious statues from their lawn.

It has also meddled in some bizarre cases, such as in 2000 when it threatened to take legal action on behalf of parents of children who were angered when the director of a library in Jacksonville, Florida, passed out certificates that referred to Hogwarts, the school of the fictional character Harry Potter.

"Witchcraft is a religion, and the certificate of witchcraft endorsed a particular religion in violation of the First Amendment establishment clause," Mathew Staver, president of Liberty Counsel, was quoted saying at the time. However, the counsel says it never pursued the case.

More recently, it has backed probate judges in Alabama who took exception to the 26 June Supreme Court ruling on gay marriage.

The Southern Poverty Law Center (SPLC), a legal advocacy group that dedicates itself to "fighting hate and bigotry", last year added the Liberty Counsel to its list of "anti-gay hate groups".

"These types of organisations end up on our hate list if they lie about an entire population based on perceived inherent characteristics, so with anti-gay groups, they get on our list if they say things like gay people tend to be paedophiles or engage in dangerous behaviours," SPLC's Heidi Beirich tells the BBC.

The Liberty Counsel rejects this categorisation and says the criteria used by the SPLC are very broad.

Ms Beirich, who runs the SPLC's intelligence project, says the Liberty Counsel has become "much more radical in the last five to six years".

'Taken for a ride'

When it comes to Kim Davis, the Liberty Counsel says it is defending the clerk based on her first amendment rights, including right to freely exercise religion and freedom of speech, "granted to her by God and guaranteed by the US constitution".

"Today a Christian is imprisoned for believing what the voters affirmed, that marriage is between a man and a woman," Mr Staver said in a press release, describing Ms Davis's jailing as a "tragic day in America".

Image copyright Getty Images Image caption The clerk's actions, or inactions, has sparked fierce debate on gay marriage in Kentucky

Liberty Counsel's Harry Mihet told the BBC his group was doing "everything that we can to restore her constitutional rights and win back her freedom in a manner that does not involve her compromising her beliefs and conscience".

But the SPLC takes issue with its approach, suggesting it is not doing everything in its legal capacity to help Ms Davis.

"What's extraordinary in Kentucky is, you know, here's the day when we're seeing a legal outfit telling its client to break the law. And it's absolutely the case that their client is defying the law. It's the law and that's that," Ms Beirich says.

The SPLC is not the Liberty Counsel's only critic to make this point. Mark Stern for Slate magazine questions whether the counsel is taking things too far, using Ms Davis's case as a means to "raise money and boost publicity for his group".

"More and more, it's beginning to look like the Liberty Counsel is taking Davis for a ride, using her doomed case to promote itself and its extremist principles."

Correction 8 September 2015: An earlier version of this story incorrectly stated that Janet Jenkins filed a lawsuit against Mathew Staver