The Spanish Supreme Court has ruled that judges in lower courts or in local town halls must marry gay and lesbian couples if required.

A magistrate in Sagunto, Valencia, had presented an appeal to the Supreme Court saying he did not want to carry out the ceremony on religious grounds, typicallyspanish.com reports.

However, the General Council for Judicial Power, the body which oversees the judiciary in Spain, has already ruled that judges cannot refuse.

In addition, the Supreme Court ruled that members of the judiciary are subject to anti-discriminatory laws in the same way as everyone else.

Spain legalised gay marriage in 2005.