A judge in Indonesia’s constitutional court has issued an apology after making a statement against equal marriage during proceedings at the House of Representatives.

Judge Arief Hidayat issued the apology on Wednesday, after making the statement in front of the House Commission, which was conducting a fit and proper test.

His statement read: “I apologize if my opinion offended the gay community. I will ask for God’s forgiveness.”

The House Commission III oversees legal affairs, and during the test, a member of the commission, Hartoyo, asked Judge Hidayat about his opinion on equal marriage, to which he replied he was opposed to it because he thought it was unconstitutional and went against his religious beliefs.

Hartoyo, a gay rights activist and the secretary general of Ourvoice, an LGBT advocacy organisation, posted an open letter following Arief’s statement.

In the letter he wrote about difficulties he faced as a gay muslim living in Indonesia, and said that he was born gay, rather than it being a product of Western culture, reports the Jakarta Globe.

“I have never been to any Western countries and I have fallen in love with men even before I understood what Indonesia and Islam were. I have been a homosexual even before I knew that homosexuality is considered to be a sin by many religious teachings,” the letter read.

“Mr Arief: if gay marriage is part of Western culture then how would you explain the fact that gay marriage is still disputed in Western countries — such as the United States — even today? Will those who are against gay marriage in those countries then argue that homosexuality is an eastern, southern or northern reality? History in fact proves that when western countries criminalized homosexuality, it was us who actually celebrated sexual diversity in our culture,” he wrote.

He also detailed an incident in which he and his partner were allegedly assaulted in Banda Aceh in 2007, following a group of men entering his home, and taking the couple to the police station.

He wrote that they were made to strip down, and were physically beaten by six police officers, who also used homophobis slurs.

Following the publication of the letter by several media outlets, David Mills, an openly gay judge from Massachusetts, wrote an email to Arief urging him to answer the letter.

On Wednesday, Hartoyo said: “Mr. Arief replied to my e-mail shortly after judge Mills wrote to him.”

Judge Arief did say that, although he meant no harm to Indonesia’s gay community, he stood by his opposition, based on the country’s constitution, that marriage can only be between a man and a woman.

He also went on to say that allowing equal marriage would go against the state’s ideology, Pancasila.

“However, as a citizen of the country, you and your community should be protected from violent acts,” Arief wrote.